Reputation: 4483
Given the following code:
Parent component:
<my-cmp readonly></my-cmp>
Child component:
...
constructor(@Attribute('readonly') readonly) {
this._readonly = readonly !== null ? 1 : 0;
}
...
How do I detect changes to the readonly attribute?
Upvotes: 1
Views: 937
Reputation: 658175
@Input()
set readonly(val) {
if(val === '') {
console.log('set');
} else {
console.log('removed');
}
Upvotes: 1