Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/schematics/angular/guard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function (options: GuardOptions): Rule {
const routerNamedImports: string[] = [...options.implements, 'MaybeAsync', 'GuardResult'];

if (options.implements.includes(GuardInterface.CanMatch)) {
routerNamedImports.push('Route', 'subPath');
routerNamedImports.push('Route', 'UrlSegment');

if (options.implements.length > 1) {
routerNamedImports.push(...commonRouterNameImports);
Expand Down
4 changes: 2 additions & 2 deletions packages/schematics/angular/guard/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ describe('Guard Schematic', () => {
const options = { ...defaultOptions, implements: implementationOptions, functional: false };
const tree = await schematicRunner.runSchematic('guard', options, appTree);
const fileString = tree.readContent('/projects/bar/src/app/foo-guard.ts');
const expectedImports = `import { CanMatch, GuardResult, MaybeAsync, Route, subPath } from '@angular/router';`;
const expectedImports = `import { CanMatch, GuardResult, MaybeAsync, Route, UrlSegment } from '@angular/router';`;

expect(fileString).toContain(expectedImports);
});
Expand Down Expand Up @@ -198,7 +198,7 @@ describe('Guard Schematic', () => {
const fileString = tree.readContent('/projects/bar/src/app/foo-guard.ts');
const expectedImports =
`import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, CanMatch, GuardResult, ` +
`MaybeAsync, Route, RouterStateSnapshot, subPath } from '@angular/router';`;
`MaybeAsync, Route, RouterStateSnapshot, UrlSegment } from '@angular/router';`;

expect(fileString).toContain(expectedImports);
});
Expand Down