this is my basepage:
@Component({
selector: ‘page-base’,
templateUrl: ‘base.html’
})
export abstract class BasePage {
needLogin = false;
constructor(protected accountData: AccountData, protected nav: NavController) { }
push(page: any) {
this.accountData.hasLoggedIn().subscribe(hasLoggedIn => {
if (hasLoggedIn) {
this.nav.push(page);
} else {
if (page.needLogin) {
this.nav.push(LoginPage);
} else {
this.nav.push(page)
}
}
});
}
pop() {
this.nav.pop();
}
setRoot(page: any) {
this.nav.setRoot(page);
}
}
then I extends basepage:
@Component({
selector: ‘page-discover’,
templateUrl: ‘discover.html’
})
export class DiscoverPage extends BasePage {
constructor(protected accountData: AccountData, protected navCtrl: NavController, ) {
super(accountData, navCtrl);
}
}
but ‘ionic serve’,I get this error:
Uncaught TypeError: Object prototype may only be an Object or null: undefined
at setPrototypeOf ()
anyone can help me, please ? thank you very much.