An elegant why to check if a Directive/Component @Input property has changed

Thabo Ambrose
Nov 6, 2022

Using the ngOnChanges hook and the ‘in’ operator.

ngOnChanges(changes) {
if ('someInputProperty' in changes) {
console.log('someInputProperty exists in changes');
}
}

--

--