我正在尝试通过离子项目实施延迟加载,但是在实施时遇到错误,我将错误置于实施延迟加载时出现的错误
core.js:1449错误错误:未捕获(承诺):TypeError:未定义 不是函数TypeError:未定义不是函数
我在下面放置代码
app.module.ts
import { NextPageModule } from '../pages/next/next.module';
import { HomePageModule } from './../pages/home/home.module';
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { MyApp } from './app.component';
@NgModule({
declarations: [
MyApp,
],
imports: [
HomePageModule,
NextPageModule,
BrowserModule,
IonicModule.forRoot(MyApp),
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}
app.component.ts
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
// import { HomePage } from '../pages/home/home';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:string = 'NextPage';
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
});
}
}
答案 0 :(得分:0)
已解决
我为解决这个错误而苦苦挣扎,我
终于找到了我刚才的解决方案
运行npm install @ionic/app-scripts@3.1.7-201801172029
或npm install @ionic/app-scripts@3.1.7
或npm install @ionic/app-scripts@Version that works for you
问题出在您的代码中,而不仅仅是应用程序脚本版本。