i have problem with canActivate angular2.0.0-rc.3.
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean>{
console.log('canActivate with AclService');
// return true;
return Observable.create((observer:Subject<boolean>) => { observer.next(true); });
}
it's not work with Observable response but work with simple boolean response.
how can i fix this problem ??
If you add .first()
or complete the Observable
by other means it should work:
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean>{
console.log('canActivate with AclService');
// return true;
return Observable.create((observer:Subject<boolean>) => { observer.next(true); }).first();
}
or
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean>{
console.log('canActivate with AclService');
// return true;
return Observable.of(true);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With