Search code examples
angularangular-template

How to update view in Angular?


I have this input

<input type="text" [ngModel]="name" (ngModelChange)="name=$event">

And this.name = 'Adam';

When I get a new name from the back end and set the value with this.name = res.data, input value on page doesn't change. Why?


Solution

  • Try this one.

    <input type="text" [(ngModel)]="name">
    

    If it is not working check your Class definition.