Unable to update value of Select from AngularJs

Posted by Ahmad.Masood on Stack Overflow See other posts from Stack Overflow or by Ahmad.Masood
Published on 2014-06-02T09:07:14Z Indexed on 2014/06/02 9:25 UTC
Read the original article Hit count: 254

Filed under:
|
|

I am unable to update value of select from AngularJs.

Here is my code

      <select ng-model="family.grade" >
         <option ng-repeat="option in options" value='{{option.id}}'>{{option.text}}</option>
      </select>

Here are the options which i am using to populate my select

var options = [{text:'Pre-K',id:'Pre-K'}, 
        {text:'K',id:'K'}, 
        {text:'1',id:'1'}, 
        {text:'2',id:'2'}, 
        {text:'3',id:'3'}, 
        {text:'4',id:'4'}, 
        {text:'5',id:'5'}, 
        {text:'6',id:'6'}, 
        {text:'7',id:'7'}, 
        {text:'8',id:'8'}, 
        {text:'+',id:'+'}];

Here is mu js code.

$scope.$watch("family_member.date_of_birth" ,function(newValue, oldValue){
    $scope.family.grade = "1" 
})

When ever value of family_member.date_of_birth changes it should set they value of select to 1. But this change is not visible on UI.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html5