I'm working in an angular project, we also use angularjs components.
Instead of using a @input variable, I wanted to use getter and setters, but came across the following bellow. I am curious to how, but am find it hard to find info on this.
this works
<foobar [(model)]="model"></foobar>
TS CODE:
@Input() set model(value: any) {
this._model= value;
console.log('I am here:', value);
}
get model() {
return this._model;
}
this doesn't
<foobar [(abc)]="model"></foobar>
TS CODE:
@Input('abc') set model(value: any) {
this._model= value;
console.log('I am here:', value);
}
get model() {
return this._model;
}
Could you please explain to me why?
Thanks