angularjs - Change <selected> value programatically -


im trying change select value programatically.

this select tag:

<select ng-options="tower tower.address tower in towers " ng-model="itemtower" ng-change="changetower();"></select> 

after select tag have button call function. function should change ng-model, , change option selected instead. not working!

this function:

$scope.edittower = function (){     $scope.itemtower = 2;  } 

yes, read other questions, helps me.

you're trying set itemtower index, should object according ng-options, try following:

$scope.edittower = function (){     $scope.itemtower = $scope.towers[2];  } 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -

r - Update two sets of radiobuttons reactively - shiny -