javascript - Dynamically add options to a Angular chosen combo box -


the following code doesn't work:

<select ui-jq='chosen' ng-model='trainer_list' multiple class="form-control" data-placeholder="select multiple trainers" ng-options='trainer.id trainer.name trainer in trainers'>  </select> 

i took angular bootstrap theme, , i'm struggling use it. want use angular script

$http({         method: 'get',         url: 'http://localhost/training_system/retrieve_train.php?trainer=y' }).success(function (result) {     $scope.trainers = result;  }); 

and use in combo box, can't use static options, apparently ones working. do?

update: tried solution abhilash using ng-repeat instead of ng-options, , worked first few attempts. no longer repeat it, , have empty dropbox. didn't change anything, it's no longer working. possible ui-jq incompatible angularjs?

try one:

<select ui-jq='chosen' ng-model='trainer_list' multiple class="form-control" data-placeholder="select multiple trainers">     <option value="{{trainer.id}}" ng-repeat="trainer in trainers"> {{trainer.name}} </option> </select> 

debug variable trainers

just add code anywhere in page debug,

<label> do: remove after testing. trainer = {{trainers}} </label> 

and see values in trainer. variable updating after server call?


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -