javascript - How do I prevent AngularJS binding recursively? -
i have select:
<select ng-model="p.value" ng-options="q q in p.value"> <option value="">select animation</option> </select> where p.value ['aaaaa', 'bbbbb', 'ccccc'] when select option select updates , shows new bunch of options like:
<option>a</option> <option>a</option> <option>a</option> <option>a</option> <option>a</option> i've structured things wrong using same value in model , options. correct way things?
you need separate array of items , model
<div ng-app ng-controller="myctrl"> <select ng-model="p.selected" ng-options="q q in p.value"> <option value="">select animation</option> </select> {{p.selected}} </div> function myctrl($scope) { $scope.p = { value: ['aaaaa', 'bbbbb', 'ccccc'], selected : null }; } what happening in example select aaaaa p.value references list of characters , since ng-options bound same $scope property drop down list updates , produces result seeing.
Comments
Post a Comment