2016-06-02 18:29:15 -04:00
|
|
|
import {Observable} from 'rxjs/Observable';
|
|
|
|
import {ActivatedRouteSnapshot, RouterStateSnapshot} from './router_state';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An interface a class can implement to be a guard deciding if a route can be activated.
|
|
|
|
*/
|
|
|
|
export interface CanActivate {
|
2016-06-08 14:13:41 -04:00
|
|
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot):
|
|
|
|
Observable<boolean>|boolean;
|
2016-06-02 18:29:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An interface a class can implement to be a guard deciding if a route can be deactivated.
|
|
|
|
*/
|
|
|
|
export interface CanDeactivate<T> {
|
2016-06-08 14:13:41 -04:00
|
|
|
canDeactivate(component: T, route: ActivatedRouteSnapshot, state: RouterStateSnapshot):
|
|
|
|
Observable<boolean>|boolean;
|
2016-06-02 18:29:15 -04:00
|
|
|
}
|