vendredi 11 septembre 2015

ng-options to work with response from promise

I am receiving a promise like so.

var GetAgentsPromise = LeadsServiceTest.GetAgents($http);
        GetAgentsPromise.then(function(response) {
            $scope.ClientAgents.id =  response.data.d.AgentIDs;
            $scope.ClientAgents.name = response.data.d.FullNames;
            console.log($scope.ClientAgents);             
        });

My select looks like so

 <select ng-model="ClientAgents">
                        <option ng-repeat="ClientAgent in ClientAgents" value="ClientAgent.id" id="SortTypeSelect" class="form-control ng-pristine ng-valid ng-touched" style="width: 70%;">{{ClientAgent.name}}</option>
                    </select>

What am I doing wrong and why ?

My response is returning the correct data.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire