0

I have a simple list of objects that I am trying to integerate to AngularJS's ui-select.

Here is the object I am trying to use <ui-select> with:

[
  {
    "getGroupsRes": {
      "groups": [
        {
          "groupID": "1",
          "applicationID": "1",
          "groupDesc": "Members",
          "groupDesc2": "MEMBERS_US_1"
        },
        {
          "groupID": "2",
          "applicationID": "1",
          "groupDesc": "Administrators",
          "groupDesc2": "ADMINS_US_100"
        },
        {
          "groupID": "3",
          "applicationID": "1",
          "groupDesc": "Moderators",
          "groupDesc2": "MODS_US_50"
        },
        {
          "groupID": "4",
          "applicationID": "1",
          "groupDesc": "Distinguished Members",
          "groupDesc2": "DMEMBS_US_50"
        },
        {
          "groupID": "5",
          "applicationID": "1",
          "groupDesc": "Elected Members",
          "groupDesc2": "EMEMS_US_75"
        },
        {
          "groupID": "6",
          "applicationID": "1",
          "groupDesc": "Staffed Officials",
          "groupDesc2": "SOFF_US_25"
        },
        {
          "groupID": "7",
          "applicationID": "1",
          "groupDesc": "Janitors",
          "groupDesc2": "JANS_US_50"
        }
      ]
    }
  }
]

and here is a live demo of the plunker: http://plnkr.co/edit/ANJcORDfoKYQ3k5X1pzs?p=preview

I think the problem comes down to me not being able to reference my objects correctly.I see no error in the console log though.What am I doing wrong?

1 Answer 1

1

Your $scope.groups variable is not an array of groups. It's an array with one element that contains the field "getGroupsRes", which contains the field "groups". So, until you clean up the data structure a bit, you can access it with the following:

repeat="group in groups[0].getGroupsRes.groups"

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.