I have an input variable called model for childComponent. @Input () model: any;
I have a parent control parentControl that send the updated input variable to childComponent.
How do I code childComponent to react to model changes? I want a childComponent call made when model changes.
Thoughts?
Consider using ngOnChanges() lifecycle
@Input() model: any;
ngOnChanges(model: any) {
this.doSomething(model);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With