ngx-sharebuttons 没有提供 Http
ngx-sharebuttons getting No Provider for Http
使用 Angular 4,并计划使用 ngx-sharebuttons (https://github.com/MurhafSousli/ngx-sharebuttons)
遇到这个错误。
ShareButtonComponent.html:2 ERROR Error: No provider for Http!
at injectionError (core.es5.js:1169)
at noProviderError (core.es5.js:1207)
at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._throwOrNull (
您缺少 http 导入
import { HttpModule } from '@angular/http';
@NgModule({
imports: [ BrowserModule, HttpModule,ShareButtonsModule.forRoot()],// missing http import module
providers: [],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
....
共享按钮演示 link 点击名片
在官方 Wiki link 中,共享按钮需要 HttpModule 请检查此 link
使用 Angular 4,并计划使用 ngx-sharebuttons (https://github.com/MurhafSousli/ngx-sharebuttons)
遇到这个错误。
ShareButtonComponent.html:2 ERROR Error: No provider for Http!
at injectionError (core.es5.js:1169)
at noProviderError (core.es5.js:1207)
at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._throwOrNull (
您缺少 http 导入
import { HttpModule } from '@angular/http';
@NgModule({
imports: [ BrowserModule, HttpModule,ShareButtonsModule.forRoot()],// missing http import module
providers: [],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
....
共享按钮演示 link 点击名片
在官方 Wiki link 中,共享按钮需要 HttpModule 请检查此 link