2
的错误:Ionic2 - 运行时错误未捕获的(在承诺):错误:没有供应商对于HTTP
Runtime Error Uncaught (in promise): Error: No provider for Http
和好了,我也有HTTP提供商,所有注册。 任何想法,我可以看看这个问题?
app.module.ts
import {NgModule, ErrorHandler} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {IonicApp, IonicModule, IonicErrorHandler} from 'ionic-angular';
import {MyApp} from './app.component';
import {StatusBar} from '@ionic-native/status-bar';
import {SplashScreen} from '@ionic-native/splash-screen';
import {GoldServiceProvider} from '../providers/gold-service/gold-service';
// ...
@NgModule({
declarations: [
MyApp,
// ...
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
// ...
],
providers: [
GoldServiceProvider,
StatusBar,
SplashScreen,
{
provide: ErrorHandler,
useClass: IonicErrorHandler
},
]
})
export class AppModule {
}
金service.ts:我提供服务
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';
@Injectable()
export class GoldServiceProvider {
...
}
thx,works .. :) – clusterBuddy