0

Give this object of objects: (filled with way more)

$scope.object = {
"activities":
{
    "1": {
        "name": "Watch a movie",
    }
    "2": {
        "name": "Chill at home",
    }
},

"people":
{
    "1": {
        "name": "with your best friend",
         }
}

How can I fill my select with all names of activities?

Right now I have

Is it possible to do this?

1
  • 1
    ng-options="activity.name for (key , activity) in object.activities" Commented Jun 9, 2015 at 7:40

1 Answer 1

3

Use ng-options:

<select ng-model="currentID" 
ng-options="id as activity.name for (id, activity) in object.activities">
</select>

Demo

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.