Skip to content

Commit 3c66ba7

Browse files
JeanMecheclydin
authored andcommitted
refactor(@angular-devkit/schematics): use self-closing tag for router-outlet
Let's make the component as simple a possible.
1 parent 18231e0 commit 3c66ba7

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/schematics/angular/app-shell/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { applyToUpdateRecorder } from '../utility/change';
3131
import { getAppModulePath, isStandaloneApp } from '../utility/ng-ast-utils';
3232
import { getMainFilePath } from '../utility/standalone/util';
3333
import { getWorkspace, updateWorkspace } from '../utility/workspace';
34-
import { Builders, ServerBuilderOptions } from '../utility/workspace-models';
34+
import { Builders } from '../utility/workspace-models';
3535
import { Schema as AppShellOptions } from './schema';
3636

3737
const APP_SHELL_ROUTE = 'shell';
@@ -130,7 +130,7 @@ function getBootstrapComponentPath(host: Tree, mainPath: string): string {
130130

131131
function validateProject(mainPath: string): Rule {
132132
return (host: Tree) => {
133-
const routerOutletCheckRegex = /<router-outlet.*?>([\s\S]*?)<\/router-outlet>/;
133+
const routerOutletCheckRegex = /<router-outlet.*?>([\s\S]*?)(?:<\/router-outlet>)?/;
134134

135135
const componentPath = getBootstrapComponentPath(host, mainPath);
136136
const tmpl = getComponentTemplateInfo(host, componentPath);

packages/schematics/angular/application/files/common-files/src/app/app.component.html.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,4 +333,4 @@
333333
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
334334

335335
<% if (routing) { %>
336-
<router-outlet></router-outlet><% } %>
336+
<router-outlet /><% } %>

packages/schematics/angular/application/files/module-files/src/app/app.component.ts.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Component } from '@angular/core';
66
<h1>Welcome to {{title}}!</h1>
77

88
<% if (routing) {
9-
%><router-outlet></router-outlet><%
9+
%><router-outlet /><%
1010
} %>
1111
`,<% } else { %>
1212
templateUrl: './app.component.html',<% } if(inlineStyle) { %>

0 commit comments

Comments
 (0)