This commit is contained in:
CHEVALLIER Abel
2025-11-13 16:23:22 +01:00
parent de9c515a47
commit cb235644dc
34924 changed files with 3811102 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [
{ path: '', pathMatch: 'full', redirectTo: '/welcome' },
{ path: 'welcome', loadChildren: () => import('./pages/welcome/welcome-module').then(m => m.WelcomeModule) }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule {}

View File

@@ -0,0 +1,46 @@
:host {
display: flex;
}
.app-layout {
height: 100vh;
}
.top-nav {
line-height: 64px;
}
.logo {
float: left;
height: 64px;
padding-right: 24px;
line-height: 64px;
background: #001529;
}
.logo img {
display: inline-block;
height: 32px;
width: 32px;
vertical-align: middle;
}
.logo h1 {
display: inline-block;
margin: 0 0 0 15px;
color: #fff;
font-weight: 600;
font-size: 20px;
font-family: Avenir,Helvetica Neue,Arial,Helvetica,sans-serif;
vertical-align: middle;
}
nz-content {
padding: 24px 50px;
}
.inner-content {
padding: 24px;
background: #fff;
height: 100%;
}

View File

@@ -0,0 +1,20 @@
<nz-layout class="app-layout">
<nz-header>
<div class="logo">
<a>
<img src="https://ng.ant.design/assets/img/logo.svg" alt="logo">
<h1>NG-ZORRO</h1>
</a>
</div>
<ul nz-menu class="top-nav" nzTheme="dark" nzMode="horizontal">
<li nz-menu-item routerLinkActive="ant-menu-item-selected" routerLink="/welcome">Home</li>
<li nz-menu-item>Account</li>
<li nz-menu-item>Profile</li>
</ul>
</nz-header>
<nz-content>
<div class="inner-content">
<router-outlet></router-outlet>
</div>
</nz-content>
</nz-layout>

View File

@@ -0,0 +1,9 @@
import { Component } from '@angular/core';
@Component({
selector: '<%= prefix %>-root',
standalone: false,
templateUrl: './app.html',
styleUrl: './app.<%= style %>'
})
export class App {}

View File

@@ -0,0 +1,12 @@
import { NgModule } from '@angular/core';
import { WelcomeRoutingModule } from './welcome-routing-module';
import <% if(!exportDefault) { %>{ <% }%>Welcome<%= classify(type) %> <% if(!exportDefault) {%>} <% }%>from './welcome<%= type ? '.' + dasherize(type): '' %>';
@NgModule({
imports: [WelcomeRoutingModule],
declarations: [Welcome<%= type ? classify(type): '' %>],
exports: [Welcome<%= type ? classify(type): '' %>]
})
export class WelcomeModule {}

View File

@@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import <% if(!exportDefault) { %>{ <% }%>Welcome<%= classify(type) %> <% if(!exportDefault) {%>} <% }%>from './welcome<%= type ? '.' + dasherize(type): '' %>';
const routes: Routes = [
{ path: '', component: Welcome<%= type ? classify(type): '' %> },
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class WelcomeRoutingModule {}

View File

@@ -0,0 +1,60 @@
"use strict";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const schematics_1 = require("@angular/cdk/schematics");
const schematics_2 = require("@angular-devkit/schematics");
const utility_1 = require("@schematics/angular/utility");
const config_1 = require("../../utils/config");
const root_module_1 = require("../../utils/root-module");
function default_1(options) {
return (host) => __awaiter(this, void 0, void 0, function* () {
var _a;
const workspace = yield (0, utility_1.readWorkspace)(host);
const project = (0, schematics_1.getProjectFromWorkspace)(workspace, options.project);
const mainFile = (0, schematics_1.getProjectMainFile)(project);
const { componentOptions, sourceDir } = yield (0, config_1.getAppOptions)(options.project, project.root);
const prefix = options.prefix || project.prefix;
const style = options.style || componentOptions.style;
const exportDefault = (_a = componentOptions.exportDefault) !== null && _a !== void 0 ? _a : false;
const isStandalone = (0, schematics_1.isStandaloneApp)(host, mainFile);
const templateSourcePath = isStandalone ? './standalone' : './files';
return (0, schematics_2.chain)([
(0, schematics_2.mergeWith)((0, schematics_2.apply)((0, schematics_2.url)(`${templateSourcePath}/src`), [
(0, schematics_2.applyTemplates)(Object.assign(Object.assign(Object.assign({}, schematics_2.strings), componentOptions), { exportDefault,
prefix,
style })),
(0, schematics_2.move)(project.sourceRoot),
(0, schematics_2.forEach)((fileEntry) => {
if (host.exists(fileEntry.path)) {
host.overwrite(fileEntry.path, fileEntry.content);
}
return fileEntry;
})
]), schematics_2.MergeStrategy.Overwrite),
(0, schematics_2.schematic)('component', Object.assign(Object.assign({ name: 'welcome', project: options.project, standalone: isStandalone }, componentOptions), { path: `${sourceDir}/pages`, skipImport: true, skipTests: true, prefix,
style })),
isStandalone ? (0, schematics_2.noop)() : addModules(options.project)
]);
});
}
function addModules(project) {
return (0, schematics_2.chain)([
(0, root_module_1.addModule)('AppRoutingModule', './app-routing-module', project),
(0, root_module_1.addModule)('NzLayoutModule', 'ng-zorro-antd/layout', project),
(0, root_module_1.addModule)('NzMenuModule', 'ng-zorro-antd/menu', project)
]);
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../schematics/ng-generate/topnav/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;AA0BH,4BAiDC;AAzED,wDAAuG;AAEvG,2DAeoC;AACpC,yDAA4D;AAG5D,+CAAmD;AACnD,yDAAoD;AAEpD,mBAAwB,OAAe;IACrC,OAAO,CAAO,IAAU,EAAE,EAAE;;QAC1B,MAAM,SAAS,GAAG,MAAM,IAAA,uBAAa,EAAC,IAAI,CAAC,CAAC;QAC5C,M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A,sBAAS,EAAC,WAAW,gCACnB,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,OAAO,CAAC,OAAO,EACxB,UAAU,EAAE,YAAY,IACrB,gBAAgB,KACnB,IAAI,EAAE,GAAG,SAAS,QAAQ,EAC1B,UAAU,EAAE,IAAI,EAChB,SAAS,EAAE,IAAI,EACf,MAAM;gBACN,KAAK,IACL;YACF,YAAY,CAAC,CAAC,CAAC,IAAA,iBAAI,GAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;SACpD,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC;AAGD,SAAS,UAAU,CAAC,OAAe;IACjC,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,uBAAS,EAAC,kBAAkB,EAAE,sBAAsB,EAAE,OAAO,CAAC;QAC9D,IAAA,uBAAS,EAAC,gBAAgB,EAAE,sBAAsB,EAAE,OAAO,CAAC;QAC5D,IAAA,uBAAS,EAAC,cAAc,EAAE,oBAAoB,EAAE,OAAO,CAAC;KACzD,CAAC,CAAC;AACL,CAAC"}

View File

@@ -0,0 +1,75 @@
"use strict";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const testing_1 = require("@angular-devkit/schematics/testing");
const schema_1 = require("@schematics/angular/ng-new/schema");
const test_app_1 = require("../../testing/test-app");
const get_file_content_1 = require("../../utils/get-file-content");
describe('[schematic] top-nav', () => {
const defaultOptions = {
project: 'ng-zorro'
};
let runner;
let appTree;
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
runner = new testing_1.SchematicTestRunner('schematics', require.resolve('../../collection.json'));
appTree = yield (0, test_app_1.createTestApp)(runner, { name: 'ng-zorro', standalone: false });
}));
it('should create top-nav files', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign({}, defaultOptions);
const tree = yield runner.runSchematic('topnav', options, appTree);
const files = tree.files;
expect(files).toEqual(jasmine.arrayContaining([
'/projects/ng-zorro/src/app/app.html',
'/projects/ng-zorro/src/app/app.css',
'/projects/ng-zorro/src/app/app.ts',
'/projects/ng-zorro/src/app/app-routing-module.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome-module.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome-routing-module.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.css',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.html'
]));
}));
it('should set the style preprocessor correctly', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign(Object.assign({}, defaultOptions), { style: schema_1.Style.Less });
const tree = yield runner.runSchematic('topnav', options, appTree);
const files = tree.files;
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
const welcomeContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts');
expect(appContent).toContain('app.less');
expect(welcomeContent).toContain('welcome.component.less');
expect(files).toEqual(jasmine.arrayContaining([
'/projects/ng-zorro/src/app/app.less',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.less'
]));
}));
it('should set the prefix correctly', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign(Object.assign({}, defaultOptions), { prefix: 'nz' });
const tree = yield runner.runSchematic('topnav', options, appTree);
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
const welcomeContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts');
expect(appContent).toContain(`selector: 'nz-root'`);
expect(welcomeContent).toContain(`selector: 'nz-welcome'`);
}));
it('should set standalone to be false', () => __awaiter(void 0, void 0, void 0, function* () {
const tree = yield runner.runSchematic('topnav', defaultOptions, appTree);
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
const welcomeContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts');
expect(appContent).toContain('standalone: false');
expect(welcomeContent).toContain('standalone: false');
}));
});
//# sourceMappingURL=index.spec.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../../schematics/ng-generate/topnav/index.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;AAGH,gEAAyE;AACzE,8DAA0D;AAI1D,qDAAuD;AACvD,mEAA8D;AAE9D,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,MAAM,cAAc,GAAc;QAChC,OAAO,EAAE,UAAU;KACpB,CAAC;IACF,IAAI,MAA2B,CAAC;IAChC,IAAI,OAAa,CAAC;IAElB,UAAU,CAAC,GAAS,EAAE;QACpB,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC;QACzF,OAAO,GAAG,MAAM,IAAA,wBAAa,EAAC,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IACjF,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAS,EAAE;QAC3C,MAAM,OAAO,qBAAO,cAAc,CAAC,CAAC;QAEpC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ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,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACnE,MAAM,UAAU,GAAG,IAAA,iCAAc,EAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;QAC7E,MAAM,cAAc,GAAG,IAAA,iCAAc,EAAC,IAAI,EAAE,+DAA+D,CAAC,CAAC;QAE7G,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QACpD,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;IAC7D,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,GAAS,EAAE;QACjD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;QAC1E,MAAM,UAAU,GAAG,IAAA,iCAAc,EAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;QAC7E,MAAM,cAAc,GAAG,IAAA,iCAAc,EAAC,IAAI,EAAE,+DAA+D,CAAC,CAAC;QAE7G,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAClD,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;IACxD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}

View File

@@ -0,0 +1,7 @@
"use strict";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=schema.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../schematics/ng-generate/topnav/schema.ts"],"names":[],"mappings":";AAAA;;;GAGG"}

View File

@@ -0,0 +1,34 @@
{
"$schema": "http://json-schema.org/schema",
"$id": "top-nav",
"title": "Top Navigation Layout",
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "The name of the project.",
"$default": {
"$source": "projectName"
}
},
"style": {
"description": "The file extension or preprocessor to use for style files.",
"type": "string",
"default": "css",
"enum": [
"css",
"scss",
"sass",
"less",
"styl"
]
},
"prefix": {
"type": "string",
"format": "html-selector",
"description": "A prefix to apply to generated selectors.",
"default": "app",
"alias": "p"
}
}
}

View File

@@ -0,0 +1,76 @@
"use strict";
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const testing_1 = require("@angular-devkit/schematics/testing");
const schema_1 = require("@schematics/angular/ng-new/schema");
const test_app_1 = require("../../testing/test-app");
const get_file_content_1 = require("../../utils/get-file-content");
describe('[schematic][standalone] top-nav', () => {
const defaultOptions = {
project: 'ng-zorro'
};
let runner;
let appTree;
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
runner = new testing_1.SchematicTestRunner('schematics', require.resolve('../../collection.json'));
appTree = yield (0, test_app_1.createTestApp)(runner, { name: 'ng-zorro' });
}));
it('should create top-nav files', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign({}, defaultOptions);
const tree = yield runner.runSchematic('topnav', options, appTree);
const files = tree.files;
expect(files).toEqual(jasmine.arrayContaining([
'/projects/ng-zorro/src/app/app.html',
'/projects/ng-zorro/src/app/app.css',
'/projects/ng-zorro/src/app/app.ts',
'/projects/ng-zorro/src/app/app.routes.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.css',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.html',
'/projects/ng-zorro/src/app/pages/welcome/welcome.routes.ts'
]));
}));
it('should fall back to the @schematics/angular:component option value', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign({}, defaultOptions);
const tree = yield runner.runSchematic('topnav', options, appTree);
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
expect(tree.exists('/projects/ng-zorro/src/app/app-module.ts')).toBe(false);
// since v19, the standalone option is removed
expect(appContent).not.toContain('standalone: true');
expect(appContent).toContain('imports: [');
}));
it('should set the style preprocessor correctly', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign(Object.assign({}, defaultOptions), { style: schema_1.Style.Less });
const tree = yield runner.runSchematic('topnav', options, appTree);
const files = tree.files;
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
const welcomeContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts');
expect(appContent).toContain('app.less');
expect(welcomeContent).toContain('welcome.component.less');
expect(files).toEqual(jasmine.arrayContaining([
'/projects/ng-zorro/src/app/app.less',
'/projects/ng-zorro/src/app/pages/welcome/welcome.component.less'
]));
}));
it('should set the prefix correctly', () => __awaiter(void 0, void 0, void 0, function* () {
const options = Object.assign(Object.assign({}, defaultOptions), { prefix: 'nz' });
const tree = yield runner.runSchematic('topnav', options, appTree);
const appContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/app.ts');
const welcomeContent = (0, get_file_content_1.getFileContent)(tree, '/projects/ng-zorro/src/app/pages/welcome/welcome.component.ts');
expect(appContent).toContain(`selector: 'nz-root'`);
expect(welcomeContent).toContain(`selector: 'nz-welcome'`);
}));
});
//# sourceMappingURL=standalone.spec.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"stand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AAG,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACnE,MAAM,UAAU,GAAG,IAAA,iCAAc,EAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;QAC7E,MAAM,cAAc,GAAG,IAAA,iCAAc,EAAC,IAAI,EAAE,+DAA+D,CAAC,CAAC;QAE7G,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QACpD,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;IAC7D,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}

View File

@@ -0,0 +1,46 @@
:host {
display: flex;
}
.app-layout {
height: 100vh;
}
.top-nav {
line-height: 64px;
}
.logo {
float: left;
height: 64px;
padding-right: 24px;
line-height: 64px;
background: #001529;
}
.logo img {
display: inline-block;
height: 32px;
width: 32px;
vertical-align: middle;
}
.logo h1 {
display: inline-block;
margin: 0 0 0 15px;
color: #fff;
font-weight: 600;
font-size: 20px;
font-family: Avenir,Helvetica Neue,Arial,Helvetica,sans-serif;
vertical-align: middle;
}
nz-content {
padding: 24px 50px;
}
.inner-content {
padding: 24px;
background: #fff;
height: 100%;
}

View File

@@ -0,0 +1,20 @@
<nz-layout class="app-layout">
<nz-header>
<div class="logo">
<a>
<img src="https://ng.ant.design/assets/img/logo.svg" alt="logo">
<h1>NG-ZORRO</h1>
</a>
</div>
<ul nz-menu class="top-nav" nzTheme="dark" nzMode="horizontal">
<li nz-menu-item routerLinkActive="ant-menu-item-selected" routerLink="/welcome">Home</li>
<li nz-menu-item>Account</li>
<li nz-menu-item>Profile</li>
</ul>
</nz-header>
<nz-content>
<div class="inner-content">
<router-outlet></router-outlet>
</div>
</nz-content>
</nz-layout>

View File

@@ -0,0 +1,6 @@
import { Routes } from '@angular/router';
export const routes: Routes = [
{ path: '', pathMatch: 'full', redirectTo: '/welcome' },
{ path: 'welcome', loadChildren: () => import('./pages/welcome/welcome.routes').then(m => m.WELCOME_ROUTES) }
];

View File

@@ -0,0 +1,12 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { NzLayoutModule } from 'ng-zorro-antd/layout';
import { NzMenuModule } from 'ng-zorro-antd/menu';
@Component({
selector: '<%= prefix %>-root',
imports: [RouterOutlet, NzLayoutModule, NzMenuModule],
templateUrl: './app.html',
styleUrl: './app.<%= style %>'
})
export class App {}

View File

@@ -0,0 +1,6 @@
import { Routes } from '@angular/router';
import <% if(!exportDefault) { %>{ <% }%>Welcome<%= classify(type) %> <% if(!exportDefault) {%>} <% }%>from './welcome<%= type ? '.' + dasherize(type): '' %>';
export const WELCOME_ROUTES: Routes = [
{ path: '', component: Welcome<%= type ? classify(type): '' %> },
];