javascript - set own value to ng-options and have the first checked -
ok i'm having following:
$scope.test = [ {"value" : 0, "text" : "00:00"}, {"value" : 900, "text" : "00:15"}, {"value" : 1800, "text" : "00:30"} ];
and in select i'm doing following:
<select ng-model="monday.morning" ng-options="obj.value obj.text obj in test">
with following results:
<select ng-model="monday.morning" ng-options="obj.value obj.text obj in test"> <option value="?" selected="selected"></option> <option value="0">00:00</option> <option value="1">00:15</option> <option value="2">00:30</option> </select>
what i'm trying accomplish having value out of json options value. , have first 1 selected. possible below?
<select ng-model="monday.morning" ng-options="obj.value obj.text obj in test"> <option value="0" selected="selected">00:00</option> <option value="900">00:15</option> <option value="1800">00:30</option> </select>
so have value in options correspond value in de test array
to set value can set model monday.morning
1 of items within select array.
for example:
$scope.monday.morning = $scope.test[1];
Comments
Post a Comment