Skip to content

Result promise #21

@jkosir

Description

@jkosir

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions