Skip to content

Commit

Permalink
fixup! refactor: introduce helper to add MetaGuard as a global guard
Browse files Browse the repository at this point in the history
  • Loading branch information
dhhyi committed Feb 10, 2020
1 parent d0f7502 commit 88a80d1
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions schematics/src/page/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,9 @@ function addRouteToArray(
options.child ? '..' : '.'
}/${dasherizedName}/${dasherizedName}-page.module').then(m => m.${strings.classify(dasherizedName)}PageModule)`;
const path = options.child ? options.child : dasherizedName;
const canActivate =
options.routingModule === '/src/app/pages/app-routing.module.ts' ? 'canActivate: [MetaGuard],' : '';

const recorder = host.beginUpdate(options.routingModule);
recorder.insertRight(
position,
`${insertComma ? ', ' : ''}{ path: '${path}', loadChildren: ${loadChildren}, ${canActivate} }`
);
recorder.insertRight(position, `${insertComma ? ', ' : ''}{ path: '${path}', loadChildren: ${loadChildren} }`);
host.commitUpdate(recorder);
}

Expand Down

0 comments on commit 88a80d1

Please sign in to comment.