I'm trying to add an array as a class member in Typescript. But when I try to access it somewhere I get an error that it is undefined. What am missing here?
.html
<button id="storePersonBtn">
.ts
export class App {
public myArray: Array<Boolean> = [];
constructor() {
console.log(this.myArray) //outputs []
$('#storePersonBtn').click(this.storePerson);
}
private storePerson() {
console.log(this.myArray) //outputs undefined
}
}