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
Post a Comment