javascript - angularjs select the first value in select box -
i need highlight first value 'fullname' in select box using angularjs. using angularstrap selectbox.
controller,
$scope.accountinfo.owners = [ { "accounts":null, "phoneumber":null, "email":null, "fullname":"mita dasgupta", "mobilephonenumber":null, "noteflag":false, "number":130000000484 } ]
template,
<button type="button" class="btn btn-default" placeholder="pleasae select" data-ng-model="owner.fullname" data-html="1" bs-options="owner owner.fullname owner in accountinfo.owners" bs-select> action <span class="caret"></span> </button>
i tried way, value not selecting default.
you should have different ng-model name used owner
in ng-options
selectedowner
<button type="button" class="btn btn-default" placeholder="pleasae select" data-ng-model="selectedowner" data-html="1" bs-options="owner owner.fullname owner in accountinfo.owners" bs-select> action <span class="caret"></span> </button>
then need set value of ng-model
controller.
$scope.selectedowner = $scope.accountinfo.owners[0];
Comments
Post a Comment