Hello, I have a similar issue. But my question is about the case where I
may have multiple directives on the page that need to pull in different
data sources? How would I separate the resolve for each instance based on
my directive definitions. Can I configure an attribute for example that
speaks to an api and resolves before the template is rendered?
On Thursday, February 7, 2013 4:43:32 PM UTC-5, arush wrote:
>
> In my controller I call a service that returns a promise. It is fetching
> external data. A directive in my view relies on this data. When I load the
> page, the directive renders immediately with undefined parameters. How can
> I delay the view from rendering the directive until the promise is resolved?
>
> I tried putting a 'resolve' in the route, but I am using a service to get
> the promise, so i can't use the below:
>
> My data is retrieved via promise in my controller like this:
>
> var promise = DataService.getThing();
>
> so I tried doing that using the example below, but the route would just
> never change, as if the promise is never resolved.
>
> PhoneListCtrl.resolve = {
> phones: function($q, DataService) { var deferred = $q.defer();
>
> deferred.resolve = DataService.getThing() // getThing returns a promise!
>
> return deferred.promise;
> }}
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.