[英]When trying to add ToastrModule.forRoot to imports the forroot throws an error
[英]ionic 2 throws : Could not find IonicModule.forRoot call in “imports”
我現在將ionic 2添加到當前的angular4項目中。
在app.module中,
import {NgModule} from '@angular/core'
import { BrowserModule } from '@angular/platform-browser';
import {AppComponent} from './app.component'
@NgModule( {
imports: [BrowserModule, IonicModule.forRoot( AppComponent )],
declarations: [AppComponent],
bootstrap: [IonicApp],
entryComponents: [
AppComponent
]
})
export class AppModule { }
但是當我使用“離子發球機”時,卻一直出現此錯誤:
00:00:15] ionic-app-script task: "serve"
[00:00:15] Error: Could not find IonicModule.forRoot call in "imports"
Error: Could not find IonicModule.forRoot call in "imports"
顯然,我已經在那里,為什么仍然拋出錯誤?
謝謝
搜索“進口”
imports: [ BrowserModule, HttpClientModule, ]
插入以下行:
IonicModule.forRoot(MyApp)
您需要從ionic-angular
導入模塊。
import {IonicApp, IonicModule} from 'ionic-angular';
將此添加到您的app.module
import { IonicModule} from 'ionic-angular';
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.