ng-change with dynamic object

Asked

Viewed 127 times

0

Good morning, I’m using angular 2 and I’m having difficulty using the property 'ng-change' after I dynamically Gero the object below:

<input type=text class="insert" id="input' + data.id + '"  ng-model="input" ng-change="myFunction()"  maxlength="48" autofocus/>

The angular properties just don’t work, how can I solve this problem?

1 answer

0

Try it like this,

change the Binding to[ngModel] and use the event (ngModelChange)

<input type=text class="insert" id="input' + data.id + '"  [ngModel]="input" (ngModelChange)="myFunction($event)" maxlength="48" autofocus/>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.