Solved

AngularJS need to set selected value

Posted on 2013-11-26
2
427 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
Comment Utility
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
Comment Utility
Thanks Once again, your expertise has shown to be top notch
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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 …

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now