title: AngularJS: Resolve in RouteProvider - detecting Success / Failure?
body: <p>I have got a resolve working on my routeprovider but I just return the promise so i don't know if its success or failure. This is what I have</p>
  
  <pre><code>.when('/items', {
      templateUrl: 'views/items.html',
      controller: 'ItemsCtrl',
      resolve: {
          resolvedData: function(Restangular) {
              return Restangular.one('Items').get();
          }
      }
  })
  </code></pre>
  
  <p>Now this does work but how do I detect success or failure. I could enter this in the resolve method, but what would I return in the success and failure. Remembering I need to have the item injected in my controller.</p>
  
  <pre><code>.when('/items', {
      templateUrl: 'views/items.html',
      controller: 'ItemsCtrl',
      resolve: {
          resolvedData: function(Restangular) {
              Restangular.one('Items').get().then(function(data) {
                  // success
              }, function() {
                  // failure
              });
          }
      }
  })
  </code></pre>
  
  <p>I did see an example here but I am confused if this is what I need and how to use it?</p>
  
  <p><a href="https://stackoverflow.com/questions/16987341/angularjs-rejected-http-promise-with-routeproviderresolve">AngularJS - rejected $http promise with $routeProvider:resolve</a></p>
  
  <p>It seems to be returning a manual promise.</p>
  
  <pre><code>resolve: {
      response: ['Warranty'
          '$q',
          function(Warranty, $q) {
              var dfd = $q.defer();
              Warranty.sendRequest().then(function(result) {
                  dfd.resolve({
                      success: true,
                      result: result
                  });
              }, function(error) {
                  dfd.resolve({
                      success: false,
                      reason: error
                  });
              });
              return dfd.promise;
          }
      ]
  }
  </code></pre>
  
  <p>What I really want to do is in my controller have the resolved variable injected into the controller, if it fails then I would also like to have access to the failure in the controller so I can display to the user that it wasn't possible to render due to an issue.</p>