I have a json defined in my scope like
$scope.People = [
{
"firstName":"John",
"lastName":"Doe",
"Choices":[
{
"Name":"Dinner",
"Options":[
{
"Name":"Fish",
"ID":1
},
{
"Name":"Chicken",
"ID":2
},
{
"Name":"Beef",
"ID":3
}
]
},
{
"Name":"Lunch",
"Options":[
{
"Name":"Macaroni",
"ID":1
},
{
"Name":"PB&J",
"ID":2
},
{
"Name":"Fish",
"ID":3
}
]
}
]
},
{
"firstName":"Jane",
"lastName":"Doe"
}
];
Wanted to list all the choices options name (without duplicates) in a single drop down box using angularjs.
The drop options will have the values Fish, Chicken, Beef, Macaroni, PB&J
<div ng-app="myApp" ng-controller="SomeController">
<select ng-model="people.Choices.Name"
ng-options="people.Choices.Name for people in People"></select>
</div>
But this is not working.
Any insights is appreciated.
Name
andID
need quotes. Here is your valid JSON: pastie.org/9418572 – Ronnie Jul 24 '14 at 22:00,
after the]
– Ronnie Jul 24 '14 at 22:05