Error: Cannot read property 'push' of undefined in [null].
class A implements OnInit {
stringArr: string[];
ngOnInit() {
for(let i=0; i<4; i++) {
this.stringArr.push("aaa");
}
}
}
Error: Cannot read property 'push' of undefined in [null].
class A implements OnInit {
stringArr: string[];
ngOnInit() {
for(let i=0; i<4; i++) {
this.stringArr.push("aaa");
}
}
}
数组需要初始化:
stringArr = [];