I tried to do that like:
@Input() data: any[] = [];
Inside ngOnInit I see undefined
:
ngOnInit() {
console.log(this.data);
}
So, below in code I get error, when I try to get length: return this.data.length;
Because it is undefined.
Why initialization does not work by default?
@Input() data: any[] = [];