如何解决运行时错误:this.initializationApp不是函数

import {

    Component,

    ViewChild

} from '@angular/core';


import {

    Platform,

    NavController

} from 'ionic-angular';


import {

    StatusBar

} from '@ionic-native/status-bar';


import {

    SplashScreen

} from '@ionic-native/splash-screen';


import {

    Storage

} from '@ionic/Storage';


import {

    HomePage

} from '../pages/home/home';


import {

    LoginPage

} from '../pages/login/login';


import {

    RegisterPage

} from '../pages/register/register';


@Component({

    templateUrl: 'app.html'

}) export class MyApp {

    _platform: Platform;


    public get platform(): Platform {

        return this._platform;

    }


    public set platform(value: Platform) {

        this._platform = value;

    }


    @ViewChild('content') nav: NavController;

    rootPage: any;

    initialization: any;

    initializationApp: any;

    Platform: any;

    statusBar: any;

    splashScreen: any;

    Storage: any;


    constructor(public platform1: Platform, public StatusBar: StatusBar, public SplashScreen: SplashScreen, private storage: Storage) {

        this.initializationApp();

    }


    initializeApp() {

        this.platform.ready().then(() => {

            this.statusBar.styleDefault();

            this.splashScreen.hide();

        });


        this.storage.get('session_storage').then((res) => {

            if (res == null) {

                this.rootPage = LoginPage;

            } else {

                this.rootPage = HomePage;

            }

        });

    }

}


猛跑小猪
浏览 128回答 1
1回答

烙印99

在您的constructor方法中,您正在调用this.initializationApp();,但实际上是在调用该方法initializeApp()。将构造函数更改为call this.initializeApp();,您应该一切顺利。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript