angular-cli/packages/schematics/angular/guard/files/__name@dasherize__.guard.ts.template
Alan Agius 36eba0c9fc refactor: use .template suffix for all schematic files
Currently when using `ivy-ngcc` it will print out a warning

```
Failed to read entry point info from //node_modules/@schematics/angular/workspace/files/package.json with error SyntaxError: Unexpected token < in JSON at position 1121.
```

Fixes #13378
2019-01-16 10:29:56 -08:00

25 lines
978 B
Plaintext

import { Injectable } from '@angular/core';
import { <%= implementationImports %>ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree } from '@angular/router';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class <%= classify(name) %>Guard implements <%= implementations %> {
<% if (implements.includes('CanActivate')) { %>canActivate(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
return true;
}
<% } %><% if (implements.includes('CanActivateChild')) { %>canActivateChild(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
return true;
}
<% } %><% if (implements.includes('CanLoad')) { %>canLoad(
route: Route,
segments: UrlSegment[]): Observable<boolean> | Promise<boolean> | boolean {
return true;
}<% } %>
}