html - initialize '--Select--' in a dropdown list -
how can initialize --select-- first option while fetching select options server using ng-options.. have tried ng-init didn't workout..
html element
<select ng-options="item item.approver1_name item in request.approver1_data track item.id" id="selectform" ng-model="selected_approver1_email" >
i able fetch list of approvers. need add --select-- option default..
you can
html
<div ng-controller="myctrl"> <select ng-options="region.code region.name region in regions" ng-model="region"> <option style="display:none" value="">--select--</option> </select> <br>selected: {{region}} </div>
controller
var myapp = angular.module('myapp', []); function myctrl($scope) { $scope.regions = [ { name: "alabama", code: "al"}, { name: "alaska", code: "ak"}, { name: "american samoa", code: "as"}, ]; }
here link working jsfiddle in can experiment further.
Comments
Post a Comment