AngularJS remove ng-options blank value

543 views Asked by At
<select ng-model="form.priority" ng-options="priority.id as priority.value for priority in leadPriority"></select>

It is showing blank option by default. How can remove it ?

3

There are 3 answers

0
devesh singhal On

Use ng-init in options eg.

<select ng-model="form.priority" ng-options="priority.id as priority.value for priority in leadPriority" ng-init="form.priority = leadPriority[0].id"></select>
0
Arulkumar On

You can set in the controller as,

$scope.form.priority = $scope.leadPriority[0].id;
0
tech_ank On

You can use ui-select which is more powerful version of select. You can find sample code for it here. You will need to include the js and css file from their library here.