0

This is my combo box:

<select  data-ng-model="data.selectedChannel" 
data-ng-options="salesChannel.value for salesChannel in salesChannels">
</select>

on my controller I have a function which calls a factory that goes away and get a key via web service for example say the key is called "HIRE". My combo box has a few options and one of them has the key of "HIRE".

Now in my controller how do I set the key so that my combo selects that option?

I thought it would be something like this:

$scope.data.selectedChannel.key = "HIRE";

But that doesnt seem to work.

enter image description here

1 Answers1

0

try this Way

for(var i=0;i<$scope.data.selectedChannel.length;i++)
{
  if($scope.data.selectedChannel[i].key=='HIRE')
  {
    $scope.data.selectedChannel = $scope.data.selectedChannel[i];
  }
}
Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234