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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -