I have used a child component in my parent component. Child onchanges is triggered first time through ngoninit. But when i trigger onClick function , Child onchanges does not get triggered. What am I doing wrong?
<app-child [inputData]="data"></app-child>
ParentComponent :
{
data = [];
ngOnInit()
{
this.data = [1,2]
}
onClick()
{
console.log("clicked");
this.data = [3,4];
}
}
ChildComponent:
@Input inputData;
ngOnChanges(changes:SimpleChanges)
{
console.log("change detected xxxxxxx");
}
NOTE: Instead of this.data = [3,4], I also tried this.data.push(3), still no change