32 lines
1.2 KiB
Plaintext
Executable File
32 lines
1.2 KiB
Plaintext
Executable File
import { Injectable } from '@angular/core';
|
|
import { <%= routerImports %> } from '@angular/router';
|
|
import { Observable } from 'rxjs';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class <%= classify(name) %>Guard implements <%= implementations %> {
|
|
<% if (implements.includes('CanActivate')) { %>canActivate(
|
|
route: ActivatedRouteSnapshot,
|
|
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
|
return true;
|
|
}
|
|
<% } %><% if (implements.includes('CanActivateChild')) { %>canActivateChild(
|
|
childRoute: ActivatedRouteSnapshot,
|
|
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
|
return true;
|
|
}
|
|
<% } %><% if (implements.includes('CanDeactivate')) { %>canDeactivate(
|
|
component: unknown,
|
|
currentRoute: ActivatedRouteSnapshot,
|
|
currentState: RouterStateSnapshot,
|
|
nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
|
return true;
|
|
}
|
|
<% } %><% if (implements.includes('CanMatch')) { %>canMatch(
|
|
route: Route,
|
|
segments: UrlSegment[]): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
|
return true;
|
|
}<% } %>
|
|
}
|