SOLVED: The modal class was missing “export” (ie export class)
I’m having a problem when trying to load and present a modal in ionic 2. (i’ve shortened this code down a tad)
import {Page, NavController, Tabs, Storage, LocalStorage, Modal, Alert, NavParams} from 'ionic-angular';
import {TandCs} from '../termsandconditions'
@Page({
templateUrl: 'build/pages/home/home.html'
})
export class Home {
static get parameters() {
return [[NavController],[Tabs],[Language]];
}
constructor(nav, tabs, language) {
this.nav = nav;
}
onPageDidEnter() {
console.log("here")
var tandcs = Modal.create(TandCs);
that.nav.present(tandcs);
}
and my modal page…
import {ViewController, Page} from ‘ionic-angular’;
import {Language} from ‘…/langservice’;
@Page({
template: `
<ion-toolbar>
<ion-title>
Description
</ion-title>
<ion-buttons start>
<button (click)="dismiss()">
<span primary showWhen="ios">Cancel</span>
<ion-icon name="md-close" showWhen="android,windows"></ion-icon>
</button>
</ion-buttons>
</ion-toolbar>
<ion-content class="has-header">
<ion-list>
<ion-item>
<h2>esrdfghio</h2>
<p>afghjk</p>
</ion-item>
</ion-list>
</ion-content>`
})
class TandCs {
static get parameters() {
return [[ViewController], [Language]];
}
constructor(viewCtrl, language) {
this.viewCtrl = viewCtrl;
this.lang = language;
this.language = { terms: language.getTerm("Title, Terms and conditions 1") }
}
close() {
this.viewCtrl.dismiss();
}
}
But this returns the following exception…
EXCEPTION: TypeError: Cannot read property 'annotations' of undefined
Any help will be greatly appreciated! Thank you!