[英]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.