我有此代码:
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:无法读取未定义的属性“ create”
出了什么问题?