Skip to content Skip to sidebar Skip to footer

Ng Option Initial Value Select

I have a dynamic combo box. I want to initialise the value of all combo boxes like this the image below is from adding static values like this $scope.newObject ={ 0 : 'N/P' ,

Solution 1:

Add this line to every dropdown option in the view:

<option value = "">N/P</option>

UPDATE:

I can see that you have an array specific for the initial values. You could use that to set the value as:

<option value = "">{{inifonction[0]}}</option> //This prints N/P

More, you could set to a scope and use it as :

$scope.tab = "N/P";

<option value = "">{{tab}}</option>

Solution 2:

this fixed my issue i hope it helps you all

<select ng-init="newObject[l.idfonction] = inifonction[0] " ng-model="newObject[l.idfonction]"  ng-options="  fct for fct in inifonction "class="form-control">

Post a Comment for "Ng Option Initial Value Select"