I'm having trouble adding an array as a class member in my Typescript code. When I try to access it in a certain function, I keep getting an error saying it's undefined. What am I doing wrong?
.html
<button id="storePersonBtn">
.ts
export class App {
public myArray: Array<Boolean> = [];
constructor() {
console.log(this.myArray) //logs []
$('#storePersonBtn').click(this.storePerson);
}
private storePerson() {
console.log(this.myArray) //logs undefined
}
}