Cannot set option value in select programmatically using AngularJs -


the select:

select(ng-model="elid", ng-change="load(elid)", ng-options="e._id e.name e in options")     option(value="") - select mashup - 

controller:

the following works, select gets populated. using broadcasts because comes socket.. don't mind that.

 //receive list  $scope.$on('list:refresh', function(ev, data) {      $scope.options = data  }) 

the following works if did not manually select option before. data.id valid entry in list.

 //refresh list of mashups when new 1 has been created  $scope.$on('list:select', function (ev, data) {        $scope.elid = data.id  }) 

if manually select option, , list:select fires, $scope.elid udated <select> not highlight option.

what going on?

solved:

the select:

select(ng-model="data.elid", ng-change="load()", ng-options="e._id e.name e in options")     option(value="") - select mashup - 

controller:

 //receive list  $scope.$on('list:refresh', function(ev, data) {      $scope.options = data  })   $scope.load() {     var elid = $scope.data.elid     ....  }   //refresh list of mashups when new 1 has been created  $scope.$on('list:select', function (ev, data) {        $scope.data.elid = data.id  }) 

i guess problem tried change selected value child controller.. using service data load controllers $scope.data = data.. meh?


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -