Skip to content
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

Result promise #21

Open
jkosir opened this issue Feb 21, 2015 · 4 comments
Open

Result promise #21

jkosir opened this issue Feb 21, 2015 · 4 comments

Comments

@jkosir
Copy link

jkosir commented Feb 21, 2015

Trying to use this in resolve block of route/state definition.
With ngResource I can access the result promise directly as .$promise. This explains why it's used.

While djResource also has a .$promise property it seems to be resolved after $http returns, but before it's populated with response data, so I can't use that like the ngResource one.
Something like this is required then (coffescript syntax):

resolve:
  apartment: (djResource, $stateParams, $q) ->
    deferred = $q.defer()
   djResource('/url/:id/').get {id: $stateParams.id}, (response) ->
      deferred.resolve(response)
   return deferred.promise

Am I missing something, is there a way to access the result promise?
Otherwise I think .$promise should be resolved after it's populated with data, mimicking ngResource.

@eliseumds
Copy link

👍

@mscienski
Copy link

👍

I've fixed this in my fork (mscienski@6963a0c), but I've also merged it with ngResource from 1.3.x and am calling it ngResource for use in my projects.

I'll send a pull request in a bit, as I need to go back and branch from master here, then test the changes against the code here.

@zzzuzik
Copy link

zzzuzik commented Apr 22, 2015

👍

1 similar comment
@niklasp
Copy link

niklasp commented Jul 27, 2015

+1

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

5 participants