Solved

AngularJS need to set selected value

Posted on 2013-11-26
2
460 Views
Last Modified: 2013-11-26
I have a select that is being filled with information from a database.  after it is full I need to select an agent in the list and set it as selected

<select id="WMRAgents" ng-model="wmrAgents" ng-options="agent as agent.ListingAgentName for agent in agents">
	<option value="">View All Agents</option>
</select> 

Open in new window


controller.js

var wmrAgentsResult = ListingsService.getAgentsByManager(
	{ "UserId": userID }
	, function (xhttp, responseHeaders) {
		$scope.agents = wmrAgentsResult;	
	}
	, function (data, status) {
		$scope.listingsLoading = false;
	}
);

Open in new window



data

ListingAgentId          ListingAgentName
2                            Tom Smith
6                            Mary Jones
0
Comment
Question by:Charles Baldo
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39678894
Try this :
var wmrAgentsResult = ListingsService.getAgentsByManager(
	{ "UserId": userID }
	, function (xhttp, responseHeaders) {
		$scope.agents = wmrAgentsResult;
                $scope.wmrAgents = $scope.agents[0];
	}
	, function (data, status) {
		$scope.listingsLoading = false;
	}
);

Open in new window

0
 

Author Closing Comment

by:Charles Baldo
ID: 39678946
Thanks Once again, your expertise has shown to be top notch
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Understanding ping command in Ubuntu 5 34
Error when Running powershell script 6 31
powershell automatic variable for results 21 28
Can anyone help me find this preloader? 51 44
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question