?
Solved

angular bind to select

Posted on 2014-09-16
1
Medium Priority
?
145 Views
Last Modified: 2014-09-16
I am having an issue binding to an array of objects using a select input.  I can use a repeater, but I can't get the select to work.

    $scope.suggestedstrategyfocusarea = [
        { name: "Strategy 1", age: 1 },
        { name: "Strategy 2", age: 1 },
        { name: "Strategy 3", age: 1 },
        { name: "Strategy 4", age: 1 }
    ];
<select id="suggestedstrategyfocusarea" ng-options="option.name for options in suggestedstrategyfocusarea"></select>

this does work however
<li ng-repeat="option in suggestedstrategyfocusarea">
      {{option.name}} = {{option.age}}
</li>
0
Comment
Question by:jackjohnson44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 40325652
Test page : http://jsfiddle.net/m2vmy1gh/

for option <--- no "s"
and you MUST have a  ng-model="strategy"

<select ng-model="strategy" ng-options="option.name for option in suggestedstrategyfocusarea"></select>

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

762 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