Linked Questions

Popular Questions

Angular ngModel with dynamic parameter

Asked by At

In this Angular example, the ngModel binding does not work. Can someone let me understand why? and if so, What is the best way to do it?

(note that the binding uses a dynamic key)


constructor() {  this.days = { day1:'data', day2:'data2', day3:'data3...' }}


<div *ngFor="let i of [1,2,3]">
   <span> {{days['day'+i]}}</span>
   <input type="text" [(ngModel)]="days['day'+i]" />

Thank you!

Related Questions