Need to know that angular ng-repeat directive actually create child scope for each element.
so if you want reference the parent $scope value need to use $parent
<span ng-show="item.name == currentDbName"><input type="text" name="newDbValue" ng-model="$parent.newDbValue" />{{$parent.newDbValue}}</span>
Or else if you want to update the repeating item value, you need to use $index
<div ng-repeat="name in dbnames track by $index">
<input type="text" ng-model="dbnames[$index]" />
</div>
the "track by $index" is new since Angular1.2 to make sure the text box won't lose focus for each key stroke
No comments:
Post a Comment