I am now adding ionic 2 into my current angular4 project.
In the 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 { }
but when I use "ionic serve", I kept having this error:
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"
Obviously, i is already there, why the error is still thrown?
Thanks
Search for "imports"
imports: [ BrowserModule, HttpClientModule, ]
Insert the following line :
IonicModule.forRoot(MyApp)
您需要从ionic-angular
导入模块。
import {IonicApp, IonicModule} from 'ionic-angular';
将此添加到您的app.module
import { IonicModule} from 'ionic-angular';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.