Get list for each list item

Hi everybody.

I have such API functions: /groups that gets list of existing groups and /group/{id}/items that gets all items in group by group’s id.

I want to show all groups:

	  <ion-item class="item-remove-animate" ng-repeat="g in groups" type="item-text-wrap">

and call API function /group/{id}/items for each group and show list of items instead of

how to do this?

Create another state/view to show the details of your group and add an href or ui-sref attribute to your ion-item.

<ion-item href="#/groups/{{}}" ng-repeat="g in groups" type="item-text-wrap">

Look at chats and chats-detail in the tabs ionic starter app.

That’s not what I need. In this case user should click on the group to get items.

I want to get items for each group automatically, So, after initial page load I should see list of groups with spinner inside each of them, each group should make request on server to get its items and substitute spinner on items list after server response

That would be quite inefficient: N+1 query performance problem.

Can’t you modify your API so that it includes items? That would require only one request and so be more efficient.