├── .editorconfig ├── .gitignore ├── LICENSE ├── README.md ├── angular.json ├── browserslist ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.e2e.json ├── now.json ├── package.json ├── prerender.ts ├── prerender.tsconfig.json ├── server.ts ├── src ├── ant-svg-icons.ts ├── app │ ├── app-routing.module.ts │ ├── app.component.html │ ├── app.component.less │ ├── app.component.ts │ ├── app.module.ts │ ├── app.server.module.ts │ ├── form │ │ ├── form-routing.module.ts │ │ ├── form.component.html │ │ ├── form.component.less │ │ ├── form.component.ts │ │ └── form.module.ts │ ├── page-header │ │ ├── page-header-actions.component.html │ │ ├── page-header-actions.component.less │ │ ├── page-header-actions.component.ts │ │ ├── page-header-routing.module.ts │ │ └── page-header.module.ts │ ├── shared.module.ts │ └── table │ │ ├── table-routing.module.ts │ │ ├── table.component.html │ │ ├── table.component.ts │ │ └── table.module.ts ├── assets │ └── .gitkeep ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── karma.conf.js ├── main.server.ts ├── main.ts ├── polyfills.ts ├── styles.less ├── test.ts ├── tsconfig.app.json ├── tsconfig.server.json ├── tsconfig.spec.json └── tslint.json ├── static.paths.ts ├── tsconfig.json ├── tslint.json ├── webpack.server.config.js └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events.json 15 | speed-measure-plugin.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Hsuan Lee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NG-ZORRO Universal Starter 2 | 3 | A NG-ZORRO starter for Universal using the Angular CLI 4 | 5 | ## Installation 6 | 7 | Run `npm install` or `yarn` 8 | 9 | ## Development 10 | 11 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 16 | 17 | ### Pre-render 18 | 19 | Run `npm run build:prerender && npm run serve:prerender`. Navigate to `http://localhost:8080/`. 20 | 21 | ### Server-side Rendering (SSR) 22 | 23 | Run `npm run build:ssr && npm run serve:ssr`. Navigate to `http://localhost:4000/`. 24 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "ng-zorro-universal-starter": { 7 | "root": "", 8 | "sourceRoot": "src", 9 | "projectType": "application", 10 | "prefix": "app", 11 | "schematics": { 12 | "@schematics/angular:component": { 13 | "style": "less", 14 | "skipTests": true 15 | }, 16 | "@schematics/angular:class": { 17 | "skipTests": true 18 | }, 19 | "@schematics/angular:directive": { 20 | "skipTests": true 21 | }, 22 | "@schematics/angular:guard": { 23 | "skipTests": true 24 | }, 25 | "@schematics/angular:module": { 26 | "skipTests": true 27 | }, 28 | "@schematics/angular:pipe": { 29 | "skipTests": true 30 | }, 31 | "@schematics/angular:service": { 32 | "skipTests": true 33 | } 34 | }, 35 | "architect": { 36 | "build": { 37 | "builder": "@angular-devkit/build-angular:browser", 38 | "options": { 39 | "outputPath": "dist/browser", 40 | "index": "src/index.html", 41 | "main": "src/main.ts", 42 | "polyfills": "src/polyfills.ts", 43 | "tsConfig": "src/tsconfig.app.json", 44 | "assets": [ 45 | "src/favicon.ico", 46 | "src/assets" 47 | ], 48 | "styles": [ 49 | "./node_modules/ng-zorro-antd/ng-zorro-antd.min.css", 50 | "src/styles.less" 51 | ], 52 | "scripts": [], 53 | "es5BrowserSupport": true 54 | }, 55 | "configurations": { 56 | "production": { 57 | "fileReplacements": [ 58 | { 59 | "replace": "src/environments/environment.ts", 60 | "with": "src/environments/environment.prod.ts" 61 | } 62 | ], 63 | "optimization": true, 64 | "outputHashing": "all", 65 | "sourceMap": false, 66 | "extractCss": true, 67 | "namedChunks": false, 68 | "aot": true, 69 | "extractLicenses": true, 70 | "vendorChunk": false, 71 | "buildOptimizer": true, 72 | "budgets": [ 73 | { 74 | "type": "initial", 75 | "maximumWarning": "2mb", 76 | "maximumError": "5mb" 77 | } 78 | ] 79 | } 80 | } 81 | }, 82 | "serve": { 83 | "builder": "@angular-devkit/build-angular:dev-server", 84 | "options": { 85 | "browserTarget": "ng-zorro-universal-starter:build" 86 | }, 87 | "configurations": { 88 | "production": { 89 | "browserTarget": "ng-zorro-universal-starter:build:production" 90 | } 91 | } 92 | }, 93 | "extract-i18n": { 94 | "builder": "@angular-devkit/build-angular:extract-i18n", 95 | "options": { 96 | "browserTarget": "ng-zorro-universal-starter:build" 97 | } 98 | }, 99 | "test": { 100 | "builder": "@angular-devkit/build-angular:karma", 101 | "options": { 102 | "main": "src/test.ts", 103 | "polyfills": "src/polyfills.ts", 104 | "tsConfig": "src/tsconfig.spec.json", 105 | "karmaConfig": "src/karma.conf.js", 106 | "styles": [ 107 | "./node_modules/ng-zorro-antd/ng-zorro-antd.min.css", 108 | "src/styles.less" 109 | ], 110 | "scripts": [], 111 | "assets": [ 112 | "src/favicon.ico", 113 | "src/assets" 114 | ] 115 | } 116 | }, 117 | "lint": { 118 | "builder": "@angular-devkit/build-angular:tslint", 119 | "options": { 120 | "tsConfig": [ 121 | "src/tsconfig.app.json", 122 | "src/tsconfig.spec.json" 123 | ], 124 | "exclude": [ 125 | "**/node_modules/**" 126 | ] 127 | } 128 | }, 129 | "server": { 130 | "builder": "@angular-devkit/build-angular:server", 131 | "options": { 132 | "outputPath": "dist/server", 133 | "main": "src/main.server.ts", 134 | "tsConfig": "src/tsconfig.server.json" 135 | }, 136 | "configurations": { 137 | "production": { 138 | "fileReplacements": [ 139 | { 140 | "replace": "src/environments/environment.ts", 141 | "with": "src/environments/environment.prod.ts" 142 | } 143 | ] 144 | } 145 | } 146 | } 147 | } 148 | }, 149 | "ng-zorro-universal-starter-e2e": { 150 | "root": "e2e/", 151 | "projectType": "application", 152 | "prefix": "", 153 | "architect": { 154 | "e2e": { 155 | "builder": "@angular-devkit/build-angular:protractor", 156 | "options": { 157 | "protractorConfig": "e2e/protractor.conf.js", 158 | "devServerTarget": "ng-zorro-universal-starter:serve" 159 | }, 160 | "configurations": { 161 | "production": { 162 | "devServerTarget": "ng-zorro-universal-starter:serve:production" 163 | } 164 | } 165 | }, 166 | "lint": { 167 | "builder": "@angular-devkit/build-angular:tslint", 168 | "options": { 169 | "tsConfig": "e2e/tsconfig.e2e.json", 170 | "exclude": [ 171 | "**/node_modules/**" 172 | ] 173 | } 174 | } 175 | } 176 | } 177 | }, 178 | "defaultProject": "ng-zorro-universal-starter" 179 | } 180 | -------------------------------------------------------------------------------- /browserslist: -------------------------------------------------------------------------------- 1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | # 5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed 6 | 7 | > 0.5% 8 | last 2 versions 9 | Firefox ESR 10 | not dead 11 | not IE 9-11 -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './src/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: require('path').join(__dirname, './tsconfig.e2e.json') 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('Welcome to ng-zorro-universal-starter!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText() { 9 | return element(by.css('nz-root h1')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /now.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "name": "ng-zorro-universal-starter" 4 | } 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ng-zorro-universal-starter", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e", 11 | "compile:server": "webpack --config webpack.server.config.js --progress --colors", 12 | "compile:prerender": "tsc -p prerender.tsconfig.json", 13 | "serve:ssr": "node dist/server", 14 | "build:ssr": "npm run build:client-and-server-bundles && npm run compile:server", 15 | "build:prerender": "npm run build:client-and-server-bundles && npm run compile:prerender && npm run generate:prerender", 16 | "generate:prerender": "cd dist && node prerender", 17 | "serve:prerender": "cd dist/browser && http-server", 18 | "build:client-and-server-bundles": "ng build --prod && ng run ng-zorro-universal-starter:server:production" 19 | }, 20 | "private": false, 21 | "dependencies": { 22 | "@angular/animations": "~8.2.7", 23 | "@angular/common": "~8.2.7", 24 | "@angular/compiler": "~8.2.7", 25 | "@angular/core": "~8.2.7", 26 | "@angular/forms": "~8.2.7", 27 | "@angular/platform-browser": "~8.2.7", 28 | "@angular/platform-browser-dynamic": "~8.2.7", 29 | "@angular/platform-server": "~8.2.7", 30 | "@angular/router": "~8.2.7", 31 | "@nguniversal/express-engine": "^8.1.1", 32 | "@nguniversal/module-map-ngfactory-loader": "8.1.1", 33 | "core-js": "^3.1.4", 34 | "express": "^4.15.2", 35 | "ng-zorro-antd": "^8.3.0", 36 | "reflect-metadata": "^0.1.13", 37 | "rxjs": "~6.5.2", 38 | "tslib": "^1.9.0", 39 | "zone.js": "~0.9.1" 40 | }, 41 | "devDependencies": { 42 | "@angular-devkit/build-angular": "~0.803.5", 43 | "@angular/cli": "~8.3.5", 44 | "@angular/compiler-cli": "~8.2.7", 45 | "@angular/language-service": "~8.2.7", 46 | "@types/jasmine": "~3.3.13", 47 | "@types/jasminewd2": "~2.0.3", 48 | "@types/node": "~12.0.12", 49 | "codelyzer": "^5.0.1", 50 | "http-server": "^0.11.1", 51 | "jasmine-core": "~3.4.0", 52 | "jasmine-spec-reporter": "~4.2.1", 53 | "karma": "~4.1.0", 54 | "karma-chrome-launcher": "~2.2.0", 55 | "karma-coverage-istanbul-reporter": "~2.0.1", 56 | "karma-jasmine": "~2.0.1", 57 | "karma-jasmine-html-reporter": "^1.4.2", 58 | "protractor": "~5.4.0", 59 | "ts-loader": "^6.0.4", 60 | "ts-node": "~8.3.0", 61 | "tslint": "~5.18.0", 62 | "typescript": "~3.5.3", 63 | "webpack-cli": "^3.1.0" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /prerender.ts: -------------------------------------------------------------------------------- 1 | // Load zone.js for the server. 2 | import 'zone.js/dist/zone-node'; 3 | import 'reflect-metadata'; 4 | import {readFileSync, writeFileSync, existsSync, mkdirSync} from 'fs'; 5 | import {join} from 'path'; 6 | 7 | import {enableProdMode} from '@angular/core'; 8 | // Faster server renders w/ Prod mode (dev mode never needed) 9 | enableProdMode(); 10 | 11 | // Fix the `Event is not defined` error https://github.com/angular/universal/issues/844 12 | global['Event'] = null; 13 | 14 | // Import module map for lazy loading 15 | import {provideModuleMap} from '@nguniversal/module-map-ngfactory-loader'; 16 | import {renderModuleFactory} from '@angular/platform-server'; 17 | import {ROUTES} from './static.paths'; 18 | 19 | // * NOTE :: leave this as require() since this file is built Dynamically from webpack 20 | const {AppServerModuleNgFactory, LAZY_MODULE_MAP} = require('./server/main'); 21 | 22 | const BROWSER_FOLDER = join(process.cwd(), 'browser'); 23 | 24 | // Load the index.html file containing referances to your application bundle. 25 | const index = readFileSync(join('browser', 'index.html'), 'utf8'); 26 | 27 | let previousRender = Promise.resolve(); 28 | 29 | // Iterate each route path 30 | ROUTES.forEach(route => { 31 | const fullPath = join(BROWSER_FOLDER, route); 32 | 33 | // Make sure the directory structure is there 34 | if (!existsSync(fullPath)) { 35 | mkdirSync(fullPath); 36 | } 37 | 38 | // Writes rendered HTML to index.html, replacing the file if it already exists. 39 | previousRender = previousRender.then(_ => renderModuleFactory(AppServerModuleNgFactory, { 40 | document: index, 41 | url: route, 42 | extraProviders: [ 43 | provideModuleMap(LAZY_MODULE_MAP) 44 | ] 45 | })).then(html => writeFileSync(join(fullPath, 'index.html'), html)); 46 | }); 47 | -------------------------------------------------------------------------------- /prerender.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | }, 19 | "include": ["prerender.ts"] 20 | } 21 | -------------------------------------------------------------------------------- /server.ts: -------------------------------------------------------------------------------- 1 | import 'zone.js/dist/zone-node'; 2 | import {enableProdMode} from '@angular/core'; 3 | // Express Engine 4 | import {ngExpressEngine} from '@nguniversal/express-engine'; 5 | // Import module map for lazy loading 6 | import {provideModuleMap} from '@nguniversal/module-map-ngfactory-loader'; 7 | 8 | import * as express from 'express'; 9 | import {join} from 'path'; 10 | 11 | // Faster server renders w/ Prod mode (dev mode never needed) 12 | enableProdMode(); 13 | 14 | // Fix the `Event is not defined` error https://github.com/angular/universal/issues/844 15 | global['Event'] = null; 16 | 17 | // Express server 18 | const app = express(); 19 | 20 | const PORT = process.env.PORT || 4000; 21 | const DIST_FOLDER = join(process.cwd(), 'dist/browser'); 22 | 23 | // * NOTE :: leave this as require() since this file is built Dynamically from webpack 24 | const {AppServerModuleNgFactory, LAZY_MODULE_MAP} = require('./dist/server/main'); 25 | 26 | // Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine) 27 | app.engine('html', ngExpressEngine({ 28 | bootstrap: AppServerModuleNgFactory, 29 | providers: [ 30 | provideModuleMap(LAZY_MODULE_MAP) 31 | ] 32 | })); 33 | 34 | app.set('view engine', 'html'); 35 | app.set('views', DIST_FOLDER); 36 | 37 | // Example Express Rest API endpoints 38 | // app.get('/api/**', (req, res) => { }); 39 | // Serve static files from /browser 40 | app.get('*.*', express.static(DIST_FOLDER, { 41 | maxAge: '1y' 42 | })); 43 | 44 | // All regular routes use the Universal engine 45 | app.get('*', (req, res) => { 46 | res.render('index', { req }); 47 | }); 48 | 49 | // Start up the Node server 50 | app.listen(PORT, () => { 51 | console.log(`Node Express server listening on http://localhost:${PORT}`); 52 | }); 53 | -------------------------------------------------------------------------------- /src/ant-svg-icons.ts: -------------------------------------------------------------------------------- 1 | import { 2 | LaptopOutline, 3 | NotificationOutline, 4 | UserOutline, 5 | ArrowLeftOutline 6 | } from '@ant-design/icons-angular/icons'; 7 | 8 | export const ANT_ICONS = [ 9 | LaptopOutline, 10 | NotificationOutline, 11 | UserOutline, 12 | ArrowLeftOutline 13 | ]; 14 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | const routes: Routes = [ 5 | { path: '', redirectTo: 'table', pathMatch: 'full' }, 6 | { path: 'table', loadChildren: () => import('./table/table.module').then(m => m.TableModule) }, 7 | { path: 'form', loadChildren: () => import('./form/form.module').then(m => m.FormModule) }, 8 | { path: 'page-header', loadChildren: () => import('./page-header/page-header.module').then(m => m.PageHeaderModule) }, 9 | { path: '**', redirectTo: '', pathMatch: 'full' } 10 | ]; 11 | 12 | @NgModule({ 13 | imports: [RouterModule.forRoot(routes)], 14 | exports: [RouterModule] 15 | }) 16 | export class AppRoutingModule { } 17 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/app/app.component.less: -------------------------------------------------------------------------------- 1 | :host(app-root) { 2 | .logo { 3 | width: 120px; 4 | height: 31px; 5 | background: rgba(255, 255, 255, 0.2); 6 | margin: 16px 28px 16px 0; 7 | float: left; 8 | } 9 | nz-layout { 10 | width: 100%; 11 | height: 100%; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.less'] 7 | }) 8 | export class AppComponent { 9 | } 10 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | import { ANT_ICONS } from '../ant-svg-icons' 4 | 5 | import { AppRoutingModule } from './app-routing.module'; 6 | import { AppComponent } from './app.component'; 7 | import { NZ_I18N, en_US, NZ_ICONS } from 'ng-zorro-antd'; 8 | import { FormsModule } from '@angular/forms'; 9 | import { HttpClientModule } from '@angular/common/http'; 10 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 11 | import { registerLocaleData } from '@angular/common'; 12 | import en from '@angular/common/locales/en'; 13 | import { SharedModule } from './shared.module' 14 | 15 | registerLocaleData(en); 16 | 17 | @NgModule({ 18 | declarations: [ 19 | AppComponent, 20 | ], 21 | imports: [ 22 | BrowserModule.withServerTransition({ appId: 'serverApp' }), 23 | AppRoutingModule, 24 | FormsModule, 25 | HttpClientModule, 26 | BrowserAnimationsModule, 27 | SharedModule 28 | ], 29 | providers: [ 30 | { provide: NZ_I18N, useValue: en_US }, 31 | { provide: NZ_ICONS, useValue: ANT_ICONS } 32 | ], 33 | bootstrap: [AppComponent] 34 | }) 35 | export class AppModule { } 36 | -------------------------------------------------------------------------------- /src/app/app.server.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { ServerModule } from '@angular/platform-server'; 3 | import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader'; 4 | import { NZ_ICONS } from 'ng-zorro-antd' 5 | import { ANT_ICONS } from '../ant-svg-icons' 6 | 7 | import { AppModule } from './app.module'; 8 | import { AppComponent } from './app.component'; 9 | 10 | // Import the require modules 11 | import { NoopAnimationsModule } from '@angular/platform-browser/animations'; 12 | import { HttpClientModule } from '@angular/common/http'; 13 | import { en_US, NZ_I18N, NzI18nModule } from 'ng-zorro-antd/i18n'; 14 | 15 | @NgModule({ 16 | imports: [ 17 | AppModule, 18 | ServerModule, 19 | ModuleMapLoaderModule, 20 | HttpClientModule, 21 | NoopAnimationsModule, 22 | NzI18nModule 23 | ], 24 | bootstrap: [AppComponent], 25 | providers: [ 26 | { provide: NZ_I18N, useValue: en_US }, 27 | { provide: NZ_ICONS, useValue: ANT_ICONS } 28 | ] 29 | }) 30 | export class AppServerModule {} 31 | -------------------------------------------------------------------------------- /src/app/form/form-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { FormComponent } from './form.component' 4 | 5 | const routes: Routes = [ 6 | { path: '', redirectTo: 'form-base', pathMatch: 'full' }, 7 | { path: 'form-base', component: FormComponent }, 8 | ]; 9 | 10 | @NgModule({ 11 | imports: [RouterModule.forChild(routes)], 12 | exports: [RouterModule] 13 | }) 14 | export class FormRoutingModule { } 15 | -------------------------------------------------------------------------------- /src/app/form/form.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | E-mail 5 | 6 | 7 | 8 | The input is not valid E-mail! 9 | 10 | 11 | 12 | 13 | Password 14 | 15 | 22 | Please input your password! 25 | 26 | 27 | 28 | Confirm Password 29 | 30 | 31 | 34 | 35 | Please confirm your password! 36 | 37 | 38 | Two passwords that you enter is inconsistent! 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Nickname 47 | 54 | 55 | 56 | 57 | 58 | Please input your nickname! 61 | 62 | 63 | 64 | Phone Number 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Please input your phone number! 78 | 79 | 80 | 81 | Website 82 | 83 | 84 | Please input website! 87 | 88 | 89 | 90 | Captcha 91 | 92 |
93 |
94 | 95 |
96 |
97 | 98 |
99 |
100 | Please input the captcha you got! 103 | We must make sure that your are a human. 104 |
105 |
106 | 107 | 108 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 |
119 | -------------------------------------------------------------------------------- /src/app/form/form.component.less: -------------------------------------------------------------------------------- 1 | 2 | [nz-form] { 3 | max-width: 600px; 4 | } 5 | -------------------------------------------------------------------------------- /src/app/form/form.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; 3 | 4 | @Component({ 5 | selector: 'app-form', 6 | templateUrl: './form.component.html', 7 | 8 | styleUrls: ['./form.component.less'] 9 | }) 10 | export class FormComponent implements OnInit { 11 | validateForm: FormGroup; 12 | 13 | submitForm(): void { 14 | for (const i in this.validateForm.controls) { 15 | this.validateForm.controls[i].markAsDirty(); 16 | this.validateForm.controls[i].updateValueAndValidity(); 17 | } 18 | } 19 | 20 | updateConfirmValidator(): void { 21 | /** wait for refresh value */ 22 | Promise.resolve().then(() => this.validateForm.controls.checkPassword.updateValueAndValidity()); 23 | } 24 | 25 | confirmationValidator = (control: FormControl): { [s: string]: boolean } => { 26 | if (!control.value) { 27 | return { required: true }; 28 | } else if (control.value !== this.validateForm.controls.password.value) { 29 | return { confirm: true, error: true }; 30 | } 31 | return {}; 32 | }; 33 | 34 | getCaptcha(e: MouseEvent): void { 35 | e.preventDefault(); 36 | } 37 | 38 | constructor(private fb: FormBuilder) {} 39 | 40 | ngOnInit(): void { 41 | this.validateForm = this.fb.group({ 42 | email: [null, [Validators.email, Validators.required]], 43 | password: [null, [Validators.required]], 44 | checkPassword: [null, [Validators.required, this.confirmationValidator]], 45 | nickname: [null, [Validators.required]], 46 | phoneNumberPrefix: ['+86'], 47 | phoneNumber: [null, [Validators.required]], 48 | website: [null, [Validators.required]], 49 | captcha: [null, [Validators.required]], 50 | agree: [false] 51 | }); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/app/form/form.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule, ReactiveFormsModule } from '@angular/forms' 4 | import { 5 | NzCheckboxModule, 6 | NzFormModule, 7 | NzGridModule, 8 | NzInputModule, 9 | NzSelectModule, 10 | NzToolTipModule 11 | } from 'ng-zorro-antd' 12 | import { SharedModule } from '../shared.module' 13 | import { FormRoutingModule } from './form-routing.module' 14 | import { FormComponent } from './form.component'; 15 | 16 | @NgModule({ 17 | declarations: [FormComponent], 18 | imports: [ 19 | CommonModule, 20 | FormRoutingModule, 21 | FormsModule, 22 | ReactiveFormsModule, 23 | SharedModule, 24 | NzFormModule, 25 | NzInputModule, 26 | NzCheckboxModule, 27 | NzSelectModule, 28 | NzToolTipModule 29 | ] 30 | }) 31 | export class FormModule { } 32 | -------------------------------------------------------------------------------- /src/app/page-header/page-header-actions.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Title 4 | This is a subtitle 5 | 6 | Warning 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 |
18 | Created 19 |

Lili Qu

20 |
21 |
22 |
23 |
24 | Association 25 | 421421 26 |
27 |
28 |
29 |
30 | Creation Time 31 |

2017-01-10

32 |
33 |
34 |
35 |
36 | Effective Time 37 |

2017-01-10

38 |
39 |
40 |
41 |
42 | Remarks 43 |

Gonghu Road, Xihu District, Hangzhou, Zhejiang, China

44 |
45 |
46 |
47 |
48 |
49 | Status 50 |

Pending

51 |
52 |
53 | Price 54 |

$ 568.08

55 |
56 |
57 |
58 |
59 | 60 | 61 | 62 | 63 | 64 | 65 |
66 | -------------------------------------------------------------------------------- /src/app/page-header/page-header-actions.component.less: -------------------------------------------------------------------------------- 1 | 2 | nz-page-header { 3 | border: 1px solid rgb(235, 237, 240); 4 | } 5 | 6 | .wrap { 7 | display: flex; 8 | } 9 | 10 | .content { 11 | flex: 1; 12 | } 13 | 14 | .content.padding { 15 | padding-left: 40px; 16 | } 17 | 18 | .content p { 19 | margin-bottom: 8px; 20 | } 21 | 22 | .content .description { 23 | display: table; 24 | } 25 | 26 | .description .term { 27 | display: table-cell; 28 | margin-right: 8px; 29 | padding-bottom: 8px; 30 | white-space: nowrap; 31 | line-height: 20px; 32 | } 33 | 34 | .description .term:after { 35 | position: relative; 36 | top: -0.5px; 37 | margin: 0 8px 0 2px; 38 | content: ':'; 39 | } 40 | 41 | .description .detail { 42 | display: table-cell; 43 | padding-bottom: 8px; 44 | width: 100%; 45 | line-height: 20px; 46 | } 47 | 48 | .extra-content { 49 | min-width: 240px; 50 | text-align: right; 51 | } 52 | 53 | .extra-content .label { 54 | font-size: 14px; 55 | color: rgba(0, 0, 0, 0.45); 56 | line-height: 22px; 57 | } 58 | 59 | .extra-content .detail { 60 | font-size: 20px; 61 | color: rgba(0, 0, 0, 0.85); 62 | line-height: 28px; 63 | } 64 | -------------------------------------------------------------------------------- /src/app/page-header/page-header-actions.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-page-header-actions', 5 | templateUrl: './page-header-actions.component.html', 6 | styleUrls: ['./page-header-actions.component.less'] 7 | }) 8 | export class PageHeaderActionsComponent {} 9 | -------------------------------------------------------------------------------- /src/app/page-header/page-header-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { PageHeaderActionsComponent } from './page-header-actions.component' 4 | 5 | const routes: Routes = [ 6 | { path: '', component: PageHeaderActionsComponent } 7 | 8 | ]; 9 | 10 | @NgModule({ 11 | imports: [RouterModule.forChild(routes)], 12 | exports: [RouterModule] 13 | }) 14 | export class PageHeaderRoutingModule { } 15 | -------------------------------------------------------------------------------- /src/app/page-header/page-header.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { NzPageHeaderModule, NzTabsModule, NzTagModule } from 'ng-zorro-antd' 4 | import { SharedModule } from '../shared.module' 5 | 6 | import { PageHeaderRoutingModule } from './page-header-routing.module'; 7 | import { PageHeaderActionsComponent } from './page-header-actions.component'; 8 | 9 | @NgModule({ 10 | declarations: [PageHeaderActionsComponent], 11 | imports: [ 12 | CommonModule, 13 | PageHeaderRoutingModule, 14 | SharedModule, 15 | NzPageHeaderModule, 16 | NzTabsModule, 17 | NzTagModule 18 | 19 | ] 20 | }) 21 | export class PageHeaderModule { } 22 | -------------------------------------------------------------------------------- /src/app/shared.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { NzButtonModule, NzGridModule, NzIconModule, NzLayoutModule, NzMenuModule } from 'ng-zorro-antd'; 4 | 5 | @NgModule({ 6 | declarations: [], 7 | imports: [ 8 | CommonModule 9 | ], 10 | exports: [ 11 | NzLayoutModule, 12 | NzMenuModule, 13 | NzButtonModule, 14 | NzIconModule, 15 | NzGridModule 16 | ] 17 | }) 18 | export class SharedModule { } 19 | -------------------------------------------------------------------------------- /src/app/table/table-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { TableComponent } from './table.component' 4 | 5 | const routes: Routes = [ 6 | { path: '', redirectTo: 'table-base', pathMatch: 'full' }, 7 | { path: 'table-base', component: TableComponent }, 8 | ]; 9 | 10 | @NgModule({ 11 | imports: [RouterModule.forChild(routes)], 12 | exports: [RouterModule] 13 | }) 14 | export class TableRoutingModule { } 15 | -------------------------------------------------------------------------------- /src/app/table/table.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Name 5 | Age 6 | Address 7 | Action 8 | 9 | 10 | 11 | 12 | {{ data.name }} 13 | {{ data.age }} 14 | {{ data.address }} 15 | 16 | Action 一 {{ data.name }} 17 | 18 | Delete 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/app/table/table.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-table', 5 | templateUrl: './table.component.html' 6 | }) 7 | export class TableComponent { 8 | listOfData = [ 9 | { 10 | key: '1', 11 | name: 'John Brown', 12 | age: 32, 13 | address: 'New York No. 1 Lake Park' 14 | }, 15 | { 16 | key: '2', 17 | name: 'Jim Green', 18 | age: 42, 19 | address: 'London No. 1 Lake Park' 20 | }, 21 | { 22 | key: '3', 23 | name: 'Joe Black', 24 | age: 32, 25 | address: 'Sidney No. 1 Lake Park' 26 | } 27 | ]; 28 | } 29 | -------------------------------------------------------------------------------- /src/app/table/table.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { NzDividerModule, NzTableModule } from 'ng-zorro-antd' 4 | import { TableComponent } from './table.component'; 5 | import { TableRoutingModule } from './table-routing.module' 6 | 7 | @NgModule({ 8 | declarations: [TableComponent], 9 | imports: [ 10 | CommonModule, 11 | TableRoutingModule, 12 | NzTableModule, 13 | NzDividerModule 14 | ] 15 | }) 16 | export class TableModule { } 17 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NG-ZORRO/ng-zorro-universal-starter/e23d8ed66090dc2ca4bd1638d09ace1ea30f6473/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NG-ZORRO/ng-zorro-universal-starter/e23d8ed66090dc2ca4bd1638d09ace1ea30f6473/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NG-ZORRO Universal Starter 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../coverage/ng-zorro-universal-starter'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /src/main.server.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | 3 | import { environment } from './environments/environment'; 4 | 5 | if (environment.production) { 6 | enableProdMode(); 7 | } 8 | 9 | export { AppServerModule } from './app/app.server.module'; 10 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | document.addEventListener('DOMContentLoaded', () => { 12 | platformBrowserDynamic().bootstrapModule(AppModule) 13 | .catch(err => console.error(err)); 14 | }); 15 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 22 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 23 | 24 | /** 25 | * Web Animations `@angular/platform-browser/animations` 26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 28 | */ 29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 30 | 31 | /** 32 | * By default, zone.js will patch all possible macroTask and DomEvents 33 | * user can disable parts of macroTask/DomEvents patch by setting following flags 34 | * because those flags need to be set before `zone.js` being loaded, and webpack 35 | * will put import in the top of bundle, so user need to create a separate file 36 | * in this directory (for example: zone-flags.ts), and put the following flags 37 | * into that file, and then add the following code before importing zone.js. 38 | * import './zone-flags.ts'; 39 | * 40 | * The flags allowed in zone-flags.ts are listed here. 41 | * 42 | * The following flags will work for all browsers. 43 | * 44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 47 | * 48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 50 | * 51 | * (window as any).__Zone_enable_cross_context_check = true; 52 | * 53 | */ 54 | 55 | /*************************************************************************************************** 56 | * Zone JS is required by default for Angular itself. 57 | */ 58 | import 'zone.js/dist/zone'; // Included with Angular CLI. 59 | 60 | 61 | /*************************************************************************************************** 62 | * APPLICATION IMPORTS 63 | */ 64 | -------------------------------------------------------------------------------- /src/styles.less: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "types": [] 6 | }, 7 | "exclude": [ 8 | "test.ts", 9 | "**/*.spec.ts" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /src/tsconfig.server.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.app.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app-server", 5 | "baseUrl": ".", 6 | "module": "commonjs" 7 | }, 8 | "angularCompilerOptions": { 9 | "entryModule": "app/app.server.module#AppServerModule" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "test.ts", 12 | "polyfills.ts" 13 | ], 14 | "include": [ 15 | "**/*.spec.ts", 16 | "**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /src/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "app", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "app", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /static.paths.ts: -------------------------------------------------------------------------------- 1 | export const ROUTES = [ 2 | '/', 3 | '/table', 4 | '/table/table-base', 5 | '/form', 6 | '/form/form-base', 7 | '/page-header' 8 | ]; 9 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "downlevelIteration": true, 6 | "outDir": "./dist/out-tsc", 7 | "sourceMap": true, 8 | "declaration": false, 9 | "module": "esnext", 10 | "moduleResolution": "node", 11 | "emitDecoratorMetadata": true, 12 | "experimentalDecorators": true, 13 | "importHelpers": true, 14 | "target": "es2015", 15 | "typeRoots": [ 16 | "node_modules/@types" 17 | ], 18 | "lib": [ 19 | "es2018", 20 | "dom" 21 | ] 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rulesDirectory": [ 4 | "codelyzer" 5 | ], 6 | "rules": { 7 | "array-type": false, 8 | "arrow-parens": false, 9 | "deprecation": { 10 | "severity": "warn" 11 | }, 12 | "import-blacklist": [ 13 | true, 14 | "rxjs/Rx" 15 | ], 16 | "interface-name": false, 17 | "max-classes-per-file": false, 18 | "max-line-length": [ 19 | true, 20 | 140 21 | ], 22 | "member-access": false, 23 | "member-ordering": [ 24 | true, 25 | { 26 | "order": [ 27 | "static-field", 28 | "instance-field", 29 | "static-method", 30 | "instance-method" 31 | ] 32 | } 33 | ], 34 | "no-consecutive-blank-lines": false, 35 | "no-console": [ 36 | true, 37 | "debug", 38 | "info", 39 | "time", 40 | "timeEnd", 41 | "trace" 42 | ], 43 | "no-empty": false, 44 | "no-inferrable-types": [ 45 | true, 46 | "ignore-params" 47 | ], 48 | "no-non-null-assertion": true, 49 | "no-redundant-jsdoc": true, 50 | "no-switch-case-fall-through": true, 51 | "no-use-before-declare": true, 52 | "no-var-requires": false, 53 | "object-literal-key-quotes": [ 54 | true, 55 | "as-needed" 56 | ], 57 | "object-literal-sort-keys": false, 58 | "ordered-imports": false, 59 | "quotemark": [ 60 | true, 61 | "single" 62 | ], 63 | "trailing-comma": false, 64 | "no-output-on-prefix": true, 65 | "no-inputs-metadata-property": true, 66 | "no-outputs-metadata-property": true, 67 | "no-host-metadata-property": true, 68 | "no-input-rename": true, 69 | "no-output-rename": true, 70 | "use-lifecycle-interface": true, 71 | "use-pipe-transform-interface": true, 72 | "component-class-suffix": true, 73 | "directive-class-suffix": true 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /webpack.server.config.js: -------------------------------------------------------------------------------- 1 | // Work around for https://github.com/angular/angular-cli/issues/7200 2 | 3 | const path = require('path'); 4 | const webpack = require('webpack'); 5 | 6 | module.exports = { 7 | mode: 'none', 8 | entry: { 9 | // This is our Express server for Dynamic universal 10 | server: './server.ts' 11 | }, 12 | target: 'node', 13 | resolve: { extensions: ['.ts', '.js'] }, 14 | optimization: { 15 | minimize: false 16 | }, 17 | output: { 18 | // Puts the output at the root of the dist folder 19 | path: path.join(__dirname, 'dist'), 20 | filename: '[name].js' 21 | }, 22 | module: { 23 | rules: [ 24 | { test: /\.ts$/, loader: 'ts-loader' }, 25 | { 26 | // Mark files inside `@angular/core` as using SystemJS style dynamic imports. 27 | // Removing this will cause deprecation warnings to appear. 28 | test: /(\\|\/)@angular(\\|\/)core(\\|\/).+\.js$/, 29 | parser: { system: true }, 30 | }, 31 | ] 32 | }, 33 | plugins: [ 34 | new webpack.ContextReplacementPlugin( 35 | // fixes WARNING Critical dependency: the request of a dependency is an expression 36 | /(.+)?angular(\\|\/)core(.+)?/, 37 | path.join(__dirname, 'src'), // location of your src 38 | {} // a map of your routes 39 | ), 40 | new webpack.ContextReplacementPlugin( 41 | // fixes WARNING Critical dependency: the request of a dependency is an expression 42 | /(.+)?express(\\|\/)(.+)?/, 43 | path.join(__dirname, 'src'), 44 | {} 45 | ) 46 | ] 47 | }; 48 | --------------------------------------------------------------------------------