title: Angular resolve functions using same api call
body: <p>I have a resolve object in UI-router working correctly; however my current setup makes two separate API calls to the same source. I don't want to cache the data because it is frequently changing, but I would like both functions to pull from one data api call. Here is my current setup.</p>
  
  <p>Basically one function gets all results and one does some looping through the results to create an array.</p>
  
  <pre><code>resolve: {
  
              recipeResource: 'RecipeResource',
  
              getRecipeData: function($stateParams, recipeResource){
                  var recipeId = $stateParams.id;
                  var getData = function(){
                      var data = recipeResource.get({recipeId: recipeId}).$promise;
                      return data;
                  }
                  return {
                      recipeId: recipeId,
                      getData: getData
  
                  }
  
              },
  
              recipe: function($stateParams, recipeResource, getRecipeData){
                  return getRecipeData.getData();
              },
              subCatArray: function($stateParams, recipeResource, getRecipeData){
  
                  var data = getRecipeData.getData().then(function(value){
                      var ingredients = value.data.ingredients;
                      var log = [];
                      angular.forEach(ingredients, function(value, key) {
                        if(value){  
                          if(value.subCategory){
                          log.push(value.subCategory);
                           };
                      };  
                      }, log);
                      return $.unique(log.concat(['']));
                  });
                  return data;
              }
  
          }
  </code></pre>