angular - 错误错误 : Uncaught (in promise): TypeError: undefined is not a function

标签 angular ionic-framework ionic2 ionic3

我正在尝试使用 ionic 项目实现延迟加载,但在实现时出现错误,我将错误放在实现延迟加载时出现的错误下方

core.js:1449 ERROR Error: Uncaught (in promise): TypeError: undefined is not a function TypeError: undefined is not a function

下面是代码

应用程序模块.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 {}

应用程序组件.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();
    });
  }
}

最佳答案

已解决

为了解决这个错误,我经历了很多痛苦,我 终于找到了我刚刚的解决方案 运行 npm install @ionic/app-scripts@3.1.7-201801172029

或者npm install @ionic/app-scripts@3.1.7

或者 npm install @ionic/app-scripts@Version 适合你

问题不在于您的代码,而在于应用程序脚本版本。

关于angular - 错误错误 : Uncaught (in promise): TypeError: undefined is not a function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54145009/

相关文章:

javascript - 在 sqlite 中出现错误,例如 ionic1 中的查询

angular - 指令在子模块中不起作用

pug - 如何在 jade 中使用 angular2 html 绑定(bind)?特别是 a([router-link]= ["/Default"])?

android - Phone Gap Facebook 插件无法通过 native Facebook 应用程序正常工作,getLoginStatus() 在 Android 上提供未知状态

javascript - ionic 2 : best way to check if is running in browser environment

android - 尝试更改 Ionic 应用程序状态栏文本颜色

angular - node_modules/@auth0/angular-jwt/lib/jwtoptions.token.d.ts(2,50) : error TS2304: Cannot find name 'unknown' 中的错误

angular - 如何在 Angular CLI 项目中启用 gzip

javascript - 如何停止拖动以在侧面菜单 ionic 1上查看

javascript - $state.go 不工作 - 错误 : $state isnot defined