angularjs - ng-value dont work on select with ng-options -


i use controller make years value in ng-options select:

    $http.post('http://www.lavorirapidi.it/app/include/profilo.asp?username='+username+'&id='+user_id)     .success(function(data){         $scope.profilo = data;         $scope.nome = username;         })     .error(function(){alert("errore di comunicazione!")});  $scope.totalyears = 100; $scope.years = []; var currentyear = new date().getfullyear();     (var = currentyear; > currentyear - $scope.totalyears; i--) {     $scope.years.push(i - 1);     } 

and html:

        <select class="form-control" ng-model="profilo.anno" ng-options="o o in years" ng-value="profilo.anno">           <option value="yyyy">yyyy</option>         </select> 

but notice if ng-value exist (for example 1999), not set on select menu!

where problem?!

edit

i think problem in controller!

try : link

controller code:

 $scope.totalyears = 100;     $scope.profilo = {anno:2013};     $scope.years = [];         var currentyear = new date().getfullyear();         (var = currentyear; > currentyear - $scope.totalyears; i--) {         $scope.years.push(i - 1);      } 

Comments