我有这个代码:
import { Component } from '@angular/core';
import {NavController } from 'ionic-angular';
import * as firebase from 'firebase';
import firebase_admin from 'firebase';
import {LoginPage} from '../login/login';
import { RegisterPage } from '../register/register';
import { Diagnostic } from '@ionic-native/diagnostic';
import { ToastController } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
static get parameters() {
return [[NavController]];
}
constructor(public navCtrl: NavController, public diagnostic: Diagnostic, public toastCtrl: ToastController) {
this.navCtrl = navCtrl;
this.toastCtrl = toastCtrl;
}
openAddPage() {
let successCallback = (isAvailable) => { this.navCtrl.push(LoginPage)
};
let toast = this.toastCtrl.create({
message: 'Test',
duration: 3000,
position: 'top'
});
this.diagnostic.isLocationAvailable().then(successCallback).catch(toast.present);
}
}
当我单击 html 文件中的登录按钮时,它会运行 (openAddPage)。当我这样做时,我收到以下错误:
TypeError:无法读取未定义的属性“创建”
问题是什么?