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