angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

Arrays of strings not being handled properly within ng-repeat

Open donovanh opened this issue 14 years ago • 22 comments

When displaying a series of values from an array, the data items are not being bound to the model properly, as in:

$scope.model = {
  values: [
    "Value 1",
    "Value 2,
    ...
  ]
}

If the above is displayed in a series of input fields, changes to the content are not reflected in the model. However, binding the above using code like the following does maintain binding to the model:

<div ng-repeat="value in model.values">
  <input type="text" ng-model="model.values[$index]" />
</div>

However the issue with this approach is that the text field loses focus on each keyup. A demo is here: http://jsfiddle.net/donovanh/GSx76/

donovanh avatar Aug 15 '12 16:08 donovanh

In the above sample ng-model not working with ng-repeat . while form submit it gives only undefined value in console....

gissivaraman avatar Jul 03 '15 13:07 gissivaraman

@gissivaraman open a new ticket and please follow the basic guidelines for submitting an issue. Don't tack your issues onto another.

bobber205 avatar Jan 26 '16 00:01 bobber205