When trying to access an exported component in Typescript, there may be issues with importing the module correctly into another component.
An error message is displayed when calling the AddToArray method:
Cannot read property 'push' of undefined
PageOne.ts
var const array = new Array(5);
export array;
class PageOne {
constructor(public navCtrl: NavController, public navParams: NavParams) {
}
GoToPage(){
this.navCtrl.push('PageTwo');
}
}
PageTwo.ts
import { players } from '../pageone/pageone.ts'
export class PlayersPage {
constructor(public navCtrl: NavController, public navParams: NavParams) { }
AddToArray(){
array.push("TEST")
}
}