Skip to content

Resolve documentation error #1771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
EricLin2004 opened this issue Feb 21, 2015 · 4 comments
Closed

Resolve documentation error #1771

EricLin2004 opened this issue Feb 21, 2015 · 4 comments

Comments

@EricLin2004
Copy link

https://github.com/angular-ui/ui-router/wiki#resolve

this example:

         promiseObj:  function($http){
            // $http returns a promise for the url data
            return $http({method: 'GET', url: '/someUrl'});
         },  

When used at the bottom, I believe it should be:

          $scope.items = promiseObj.data.items;

to reflect #77.

On the other hand, would it be feasible to have ui-router run angular $http's .success if it exists instead of .then ?

I find myself having to do this:

         promiseObj:  function($http){
            // $http returns a promise for the url data
            return $http({method: 'GET', url: '/someUrl'})
                     .then(function(res) {
                        return res.data;
                      });
         },

all the time.

@eddiemonge
Copy link
Contributor

that seems valid. in your controller you would have:

promiseObj.then(function(response) {
  $scope.items = response.data.items;
});

@EricLin2004
Copy link
Author

Right, the documentation shows

$scope.items = response.items;

right now.

@eddiemonge
Copy link
Contributor

Updated. Its a wiki just so you know.

@EricLin2004
Copy link
Author

Ah, thanks. Haven't contributed much to open source, didn't want to mess anything up ;p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants