angular - ng2-auto-complete ngModel does not change value -
i using ng2-auto-complete module. have validation form , want change ngmodel value, when user selects value data (autocomplete).
i don´t want change value via valuechangedevent, because use module more once. want bind ngmodel auto-complete value. how possible?
this not working:
<div ng2-auto-complete [source]="getvalue('country')" placeholder="enter text"> <input [(ngmodel)]="person.country" /> </div> if select value person.country not change.
thx in advance!
you try use function on input event :
<input [(ngmodel)]="person.country" #myinput (input)="changemodel(myinput.value)"/> // ts changemodel(value: string) { this.person.country = value; } or can use onchange implementation
export class myclass implements onchanges { // ... ngonchanges(changes: simplechanges) { this.person.country = changes.allresults.currentvalue; } }
Comments
Post a Comment