I have a ionic1 application which works with my API endpoints.

I've created a service which on call gets categories. 

```
.factory('expenses', function($http) {

    var expenseCategories = [];

    return {

        getCategories: function(){

            return $http.get('URL_HERE').then(function(response){
                expenseCategories = response.data.data[0];
                return expenseCategories.categories;
            });

        }

    }

})

```

I call the service in my controller

```
.controller('expenseCategoryCtrl', function($scope, $state, expenses) {

  $scope.categories = expenses;
  $scope.data = $scope.categories.getCategories();
  console.log($scope.data);

})

```

When console logging the response it returns a promise rather than my usual json from the API. If I call the API in the controller I can ng-repeat the collection with no issues however now it's in a service it's wrapped in this "promise" and I'm unsure how to output the collection.

[![Screenshot of Console Log](https://i.stack.imgur.com/Vn5fq.png)](https://i.stack.imgur.com/Vn5fq.png)

I've tried

```
<li class="item item-toggle" ng-repeat="categories as category">
         {{ category }}
      </li>

```

but I get the error

> 
> [ngRepeat:iexp] Expected expression in form of '*item* in
>  *collection*[ track by *id*]' but got 'categories as category'.
> 
> 
> 

I believe this is a case of not understanding the promise.