javascript - Updating input values from selected option in dropdown in ng-repeat Angularjs -
Hi, I have down-down in my ng-repeat
& lt; Div ng-repeat = "one in item" & gt; & Lt; Select ng-model = a.id ng-option = "allitems for c for c.id as c" ng-init = "a.age = c.age" & gt; & Lt; / Select & gt; & Lt; Input ng-model = "a.age" /> & Lt; / Div & gt; When ng-repeat runs, it runs all vavlues with the dropdown option properly. The problem is that if I change the drop down value in any row, then it does not update the AAG, which is one of the areas of all types in the drop down.
Please tell me that when a different option is selected in the dropdown, how can corrosponding c.age update a.age value
There are two things that you need to understand.
First, bind the model instead of items
& lt; Select ng-model = "item" ... & gt; Second, use this track to force the item to be used by the expression and
Code snippet
& lt; Div ng-repeat = "item in item" & gt; & Lt; Select ng-model = "item" ng-option = "item 2. Item item 2. Item item 2. Item by item 2.id"> gt; & Lt; / Select & gt; & Lt; Input ng-model = "item.age" /> & Lt; / Div & gt; Plunker Edition
Comments
Post a Comment