dashboard.service.ts未處理的承諾拒絕:沒有AuthHttp的提供者! ;區:角在angular2,智威湯遜
import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import { AuthHttp } from 'angular2-jwt';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
constructor (private http: Http,private authHttp: AuthHttp) {}
當我做到這一點給出了一個錯誤Error: Uncaught (in promise): Error: DI
app.module.ts
import { HttpModule } from '@angular/http';
import { AuthModule } from 'angular2-jwt';
.
imports: [
HttpModule,
AuthModule
],
我如何解決這個?
你有進口的HttpModule在ngmodule?您是否將AuthHttp設置爲ngModule中的提供者? :) – Alex
no .............. –
我更新了我的問題並添加了app.module.ts –