Solved

AngularJS need to set selected value

Posted on 2013-11-26
2
455 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:charlesbaldo
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:charlesbaldo
ID: 39678946
Thanks Once again, your expertise has shown to be top notch
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

809 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