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"); } } }
The array needs to be initialized:
stringArr = [];
2.1m questions
2.1m answers
60 comments
56.9k users