Didier68
Didier68

Reputation: 1323

Angular : select / ng-option not fired

I have a little problem with Angular and a select : i don't see my bug... Could someone help me ?

<div  ng-app="imputationApp" ng-controller="imputationController" >
 <fieldset> <legend>Imputation :</legend>  
 <select class="liste-candidats-select" ng-model="currentSL" ng-options="item as item.desc for item in  sousLignes"  ></select>
   <br />
<span> aE: {{currentSL.desc}} / {{currentSL.slidx}}  </span> 
</fieldset> 
</div>

My controller :

var imputationApp = angular.module('imputationApp', []).controller('imputationController', function($scope) {
    $scope.currentSL = '';
    $scope.sousLignes = [ { "slidx":"c5!1875354624","desc":"option1 " }, {"slidx":"c9!1875379297","desc":"option 2" }, { "slidx":"c9!1875379392","desc":"option 3" } ]  ;

});

It could be tested on http://jsfiddle.net/zDvD9/77/

Thanks. Didier

Upvotes: 0

Views: 49

Answers (1)

tymeJV
tymeJV

Reputation: 104775

Use the console - you were declaring a module called epfApp in the fiddle options and not registering that anywhere.

Using the console you would've seen:

Uncaught Error: [$injector:modulerr] Failed to instantiate module epfApp

Working: http://jsfiddle.net/zDvD9/78/ (removed "Body tag" from fiddle options)

Upvotes: 2

Related Questions