https://angular.io/docs/ts/latest/api/router/index/OnActivate-interface.html
https://angular.io/docs/ts/latest/api/router-deprecated/index/CanActivate-decorator.html
https://github.com/angular/angular/issues/4112#issuecomment-153811572

On Sunday, June 5, 2016 at 3:03:40 PM UTC+2, Günter Zöchbauer wrote:
>
> You can use `OnActivate` or `CanActivate`. There is an open issue AFAIK 
> that one of these doesn't wait for a returned promise to complete.
>
> I think just wrapping the template with `*ngIf="data"` is a good solution 
> to prevent rendering unless data is available but many don't like it.
>
> On Sunday, June 5, 2016 at 2:02:44 PM UTC+2, Christophe HOARAU wrote:
>>
>> Hi,
>>
>> I have a global service, in which I would like some action to happen when 
>> I change the route but *before* the view is initialized (before 
>> ngOnInit).
>> When I subscribe to router directly the event is triggered after the view 
>> is initialized. In angular 1 there used to be quite a lots of events 
>> catchable on route changes but I can't find anything equivalent in angular2 
>> except the very limited subscription to router.
>> As this needs to apply on each route I don't want tu manually configure 
>> each routes to make a call to the service. This could only lead to errors I 
>> think.
>>
>> I can't find anything in the docs, could someone help me please.
>>
>> Thanks.
>>
>

-- 
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 https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to