File tree Expand file tree Collapse file tree
packages/schematics/angular/module
files/__name@dasherize@if-flat__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { NgModule } from '@angular/core';<% if (commonModule) { %>
2- import { CommonModule } from '@angular/common';<% } %><% if (lazyRoute && routeDeclarationInlined ) { %>
2+ import { CommonModule } from '@angular/common';<% } %><% if (lazyRouteWithoutRouteModule ) { %>
33import { Routes, RouterModule } from '@angular/router';<% } %>
4- <% if (routing || lazyRoute && !routeDeclarationInlined ) { %>
4+ <% if (routing || lazyRouteWithRouteModule ) { %>
55import { <%= classify(name) %>RoutingModule } from './<%= dasherize(name) %>-routing.module';<% } %>
6- <% if (lazyRoute && routeDeclarationInlined ) { %>
6+ <% if (lazyRouteWithoutRouteModule ) { %>
77const routes: Routes = [
88 { path: '', component: <%= classify(name) %>Component }
99];<% } %>
1010
1111@NgModule({
1212 declarations: [],
1313 imports: [<% if (commonModule) { %>
14- CommonModule<%= routing || lazyRoute && !routeDeclarationInlined ? ',' : '' %><% } %><% if (routing || lazyRoute && !routeDeclarationInlined ) { %>
15- <%= classify(name) %>RoutingModule<% } %><%= lazyRoute && routeDeclarationInlined ? ',' : '' %><% if (lazyRoute && routeDeclarationInlined ) { %>
14+ CommonModule<%= routing || lazyRouteWithRouteModule ? ',' : '' %><% } %><% if (routing || lazyRouteWithRouteModule ) { %>
15+ <%= classify(name) %>RoutingModule<% } %><%= lazyRouteWithoutRouteModule ? ',' : '' %><% if (lazyRouteWithoutRouteModule ) { %>
1616 RouterModule.forChild(routes)<% } %>
1717 ]
1818})
Original file line number Diff line number Diff line change @@ -158,7 +158,8 @@ export default function (options: ModuleOptions): Rule {
158158 ...strings ,
159159 'if-flat' : ( s : string ) => options . flat ? '' : s ,
160160 lazyRoute : isLazyLoadedModuleGen ,
161- routeDeclarationInlined : ! routingModulePath ,
161+ lazyRouteWithoutRouteModule : isLazyLoadedModuleGen && ! routingModulePath ,
162+ lazyRouteWithRouteModule : isLazyLoadedModuleGen && routingModulePath ,
162163 ...options ,
163164 } ) ,
164165 move ( parsedPath . path ) ,
You can’t perform that action at this time.
0 commit comments