├── .editorconfig ├── .gitignore ├── .prettierrc ├── README.md ├── angular.json ├── package-lock.json ├── package.json ├── projects └── my-epic-app │ ├── browserslist │ ├── e2e │ ├── protractor.conf.js │ ├── src │ │ ├── app.e2e-spec.ts │ │ └── app.po.ts │ └── tsconfig.json │ ├── karma.conf.js │ ├── src │ ├── app │ │ ├── app-routing.module.ts │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── core │ │ │ ├── core.module.ts │ │ │ └── layout │ │ │ │ └── main-layout │ │ │ │ ├── main-layout.component.html │ │ │ │ ├── main-layout.component.scss │ │ │ │ ├── main-layout.component.spec.ts │ │ │ │ └── main-layout.component.ts │ │ ├── features │ │ │ ├── admin │ │ │ │ ├── admin-routing.module.ts │ │ │ │ ├── admin.component.html │ │ │ │ ├── admin.component.scss │ │ │ │ ├── admin.component.spec.ts │ │ │ │ ├── admin.component.ts │ │ │ │ └── admin.module.ts │ │ │ └── home │ │ │ │ ├── home-routing.module.ts │ │ │ │ ├── home.component.html │ │ │ │ ├── home.component.scss │ │ │ │ ├── home.component.spec.ts │ │ │ │ ├── home.component.ts │ │ │ │ └── home.module.ts │ │ └── shared │ │ │ ├── shared.module.ts │ │ │ └── tag-list │ │ │ ├── tag-list.component.html │ │ │ ├── tag-list.component.scss │ │ │ ├── tag-list.component.spec.ts │ │ │ └── tag-list.component.ts │ ├── assets │ │ └── .gitkeep │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ ├── styles.scss │ └── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ └── tslint.json ├── tsconfig.json └── tslint.json /.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 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AngularArchitectureExample 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.2. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 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 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 28 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "my-epic-app": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | } 12 | }, 13 | "root": "projects/my-epic-app", 14 | "sourceRoot": "projects/my-epic-app/src", 15 | "prefix": "my-org", 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "dist/my-epic-app", 21 | "index": "projects/my-epic-app/src/index.html", 22 | "main": "projects/my-epic-app/src/main.ts", 23 | "polyfills": "projects/my-epic-app/src/polyfills.ts", 24 | "tsConfig": "projects/my-epic-app/tsconfig.app.json", 25 | "aot": true, 26 | "assets": [ 27 | "projects/my-epic-app/src/favicon.ico", 28 | "projects/my-epic-app/src/assets" 29 | ], 30 | "styles": [ 31 | "projects/my-epic-app/src/styles.scss" 32 | ], 33 | "scripts": [] 34 | }, 35 | "configurations": { 36 | "production": { 37 | "fileReplacements": [ 38 | { 39 | "replace": "projects/my-epic-app/src/environments/environment.ts", 40 | "with": "projects/my-epic-app/src/environments/environment.prod.ts" 41 | } 42 | ], 43 | "optimization": true, 44 | "outputHashing": "all", 45 | "sourceMap": false, 46 | "extractCss": true, 47 | "namedChunks": false, 48 | "extractLicenses": true, 49 | "vendorChunk": false, 50 | "buildOptimizer": true, 51 | "budgets": [ 52 | { 53 | "type": "initial", 54 | "maximumWarning": "2mb", 55 | "maximumError": "5mb" 56 | }, 57 | { 58 | "type": "anyComponentStyle", 59 | "maximumWarning": "6kb", 60 | "maximumError": "10kb" 61 | } 62 | ] 63 | } 64 | } 65 | }, 66 | "serve": { 67 | "builder": "@angular-devkit/build-angular:dev-server", 68 | "options": { 69 | "browserTarget": "my-epic-app:build" 70 | }, 71 | "configurations": { 72 | "production": { 73 | "browserTarget": "my-epic-app:build:production" 74 | } 75 | } 76 | }, 77 | "extract-i18n": { 78 | "builder": "@angular-devkit/build-angular:extract-i18n", 79 | "options": { 80 | "browserTarget": "my-epic-app:build" 81 | } 82 | }, 83 | "test": { 84 | "builder": "@angular-devkit/build-angular:karma", 85 | "options": { 86 | "main": "projects/my-epic-app/src/test.ts", 87 | "polyfills": "projects/my-epic-app/src/polyfills.ts", 88 | "tsConfig": "projects/my-epic-app/tsconfig.spec.json", 89 | "karmaConfig": "projects/my-epic-app/karma.conf.js", 90 | "assets": [ 91 | "projects/my-epic-app/src/favicon.ico", 92 | "projects/my-epic-app/src/assets" 93 | ], 94 | "styles": [ 95 | "projects/my-epic-app/src/styles.scss" 96 | ], 97 | "scripts": [] 98 | } 99 | }, 100 | "lint": { 101 | "builder": "@angular-devkit/build-angular:tslint", 102 | "options": { 103 | "tsConfig": [ 104 | "projects/my-epic-app/tsconfig.app.json", 105 | "projects/my-epic-app/tsconfig.spec.json", 106 | "projects/my-epic-app/e2e/tsconfig.json" 107 | ], 108 | "exclude": [ 109 | "**/node_modules/**" 110 | ] 111 | } 112 | }, 113 | "e2e": { 114 | "builder": "@angular-devkit/build-angular:protractor", 115 | "options": { 116 | "protractorConfig": "projects/my-epic-app/e2e/protractor.conf.js", 117 | "devServerTarget": "my-epic-app:serve" 118 | }, 119 | "configurations": { 120 | "production": { 121 | "devServerTarget": "my-epic-app:serve:production" 122 | } 123 | } 124 | } 125 | } 126 | }}, 127 | "defaultProject": "my-epic-app" 128 | } 129 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-architecture-example", 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 | "format:write": "prettier projects/**/*.{ts,json,md,scss} --write", 12 | "format:test": "prettier projects/**/*.{ts,json,md,scss} --list-different", 13 | "analyze": "ng build --prod --stats-json && webpack-bundle-analyzer ./dist/my-epic-app/stats-es2015.json" 14 | }, 15 | "private": true, 16 | "dependencies": { 17 | "@angular/animations": "~9.0.1", 18 | "@angular/cdk": "^9.0.0", 19 | "@angular/common": "~9.0.1", 20 | "@angular/compiler": "~9.0.1", 21 | "@angular/core": "~9.0.1", 22 | "@angular/forms": "~9.0.1", 23 | "@angular/material": "^9.0.0", 24 | "@angular/platform-browser": "~9.0.1", 25 | "@angular/platform-browser-dynamic": "~9.0.1", 26 | "@angular/router": "~9.0.1", 27 | "rxjs": "~6.5.4", 28 | "tslib": "^1.10.0", 29 | "zone.js": "~0.10.2" 30 | }, 31 | "devDependencies": { 32 | "@angular-devkit/build-angular": "~0.900.2", 33 | "@angular/cli": "~9.0.2", 34 | "@angular/compiler-cli": "~9.0.1", 35 | "@angular/language-service": "~9.0.1", 36 | "@types/jasmine": "~3.5.0", 37 | "@types/jasminewd2": "~2.0.3", 38 | "@types/node": "^12.11.1", 39 | "codelyzer": "^5.1.2", 40 | "jasmine-core": "~3.5.0", 41 | "jasmine-spec-reporter": "~4.2.1", 42 | "karma": "~4.3.0", 43 | "karma-chrome-launcher": "~3.1.0", 44 | "karma-coverage-istanbul-reporter": "~2.1.0", 45 | "karma-jasmine": "~2.0.1", 46 | "karma-jasmine-html-reporter": "^1.4.2", 47 | "prettier": "^1.19.1", 48 | "protractor": "~5.4.3", 49 | "ts-node": "~8.3.0", 50 | "tslint": "~5.18.0", 51 | "tslint-config-prettier": "^1.18.0", 52 | "typescript": "~3.7.5", 53 | "webpack-bundle-analyzer": "^3.6.0" 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /projects/my-epic-app/browserslist: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # You can see what browsers were selected by your queries by running: 6 | # npx browserslist 7 | 8 | > 0.5% 9 | last 2 versions 10 | Firefox ESR 11 | not dead 12 | not IE 9-11 # For IE 9-11 support, remove 'not'. -------------------------------------------------------------------------------- /projects/my-epic-app/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | baseUrl: 'http://localhost:4200/', 20 | framework: 'jasmine', 21 | jasmineNodeOpts: { 22 | showColors: true, 23 | defaultTimeoutInterval: 30000, 24 | print: function() {} 25 | }, 26 | onPrepare() { 27 | require('ts-node').register({ 28 | project: require('path').join(__dirname, './tsconfig.json') 29 | }); 30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 31 | } 32 | }; -------------------------------------------------------------------------------- /projects/my-epic-app/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('my-epic-app app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser 19 | .manage() 20 | .logs() 21 | .get(logging.Type.BROWSER); 22 | expect(logs).not.toContain( 23 | jasmine.objectContaining({ 24 | level: logging.Level.SEVERE 25 | } as logging.Entry) 26 | ); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /projects/my-epic-app/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo(): Promise { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText(): Promise { 9 | return element(by.css('my-org-root .content span')).getText() as Promise< 10 | string 11 | >; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /projects/my-epic-app/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../out-tsc/e2e", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": ["jasmine", "jasminewd2", "node"] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /projects/my-epic-app/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/my-epic-app'), 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 | -------------------------------------------------------------------------------- /projects/my-epic-app/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 | { 6 | path: '', 7 | pathMatch: 'full', 8 | redirectTo: 'home' 9 | }, 10 | { 11 | path: 'home', 12 | loadChildren: () => 13 | import('./features/home/home.module').then(m => m.HomeModule) 14 | }, 15 | { 16 | path: 'admin', 17 | loadChildren: () => 18 | import('./features/admin/admin.module').then(m => m.AdminModule) 19 | }, 20 | { 21 | path: '**', 22 | redirectTo: 'home' 23 | } 24 | ]; 25 | 26 | @NgModule({ 27 | imports: [RouterModule.forRoot(routes)], 28 | exports: [RouterModule] 29 | }) 30 | export class AppRoutingModule {} 31 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomastrajan/angular-architecture-example/3a66b65dee1ef5a0771afea5bcf6bdeb1e40235b/projects/my-epic-app/src/app/app.component.scss -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { NoopAnimationsModule } from '@angular/platform-browser/animations'; 4 | 5 | import { CoreModule } from './core/core.module'; 6 | 7 | import { AppComponent } from './app.component'; 8 | 9 | describe('AppComponent', () => { 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | imports: [NoopAnimationsModule, RouterTestingModule, CoreModule], 13 | declarations: [AppComponent] 14 | }).compileComponents(); 15 | })); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'my-org-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.scss'] 7 | }) 8 | export class AppComponent { 9 | title = 'my-epic-app'; 10 | } 11 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | 3 | import { CoreModule } from './core/core.module'; 4 | 5 | import { AppRoutingModule } from './app-routing.module'; 6 | import { AppComponent } from './app.component'; 7 | 8 | @NgModule({ 9 | declarations: [AppComponent], 10 | imports: [CoreModule, AppRoutingModule], 11 | providers: [], 12 | bootstrap: [AppComponent] 13 | }) 14 | export class AppModule {} 15 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/core/core.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | import { BrowserModule } from '@angular/platform-browser'; 4 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 5 | import { MatButtonModule } from '@angular/material/button'; 6 | import { MatToolbarModule } from '@angular/material/toolbar'; 7 | 8 | import { MainLayoutComponent } from './layout/main-layout/main-layout.component'; 9 | 10 | @NgModule({ 11 | declarations: [MainLayoutComponent], 12 | imports: [ 13 | // vendor 14 | BrowserModule, 15 | BrowserAnimationsModule, 16 | RouterModule, 17 | 18 | // material 19 | MatToolbarModule, 20 | MatButtonModule 21 | ], 22 | exports: [MainLayoutComponent] 23 | }) 24 | export class CoreModule {} 25 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/core/layout/main-layout/main-layout.component.html: -------------------------------------------------------------------------------- 1 | 2 | My Epic App 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 |
13 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/core/layout/main-layout/main-layout.component.scss: -------------------------------------------------------------------------------- 1 | .spacer { 2 | flex: 1 0 auto; 3 | } 4 | 5 | button { 6 | margin: 0 10px; 7 | 8 | &.active { 9 | filter: brightness(120%); 10 | } 11 | } 12 | 13 | main { 14 | padding: 20px 20%; 15 | } 16 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/core/layout/main-layout/main-layout.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { MainLayoutComponent } from './main-layout.component'; 4 | 5 | describe('MainLayoutComponent', () => { 6 | let component: MainLayoutComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [MainLayoutComponent] 12 | }).compileComponents(); 13 | })); 14 | 15 | beforeEach(() => { 16 | fixture = TestBed.createComponent(MainLayoutComponent); 17 | component = fixture.componentInstance; 18 | fixture.detectChanges(); 19 | }); 20 | 21 | it('should create', () => { 22 | expect(component).toBeTruthy(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/core/layout/main-layout/main-layout.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'my-org-main-layout', 5 | templateUrl: './main-layout.component.html', 6 | styleUrls: ['./main-layout.component.scss'] 7 | }) 8 | export class MainLayoutComponent implements OnInit { 9 | constructor() {} 10 | 11 | ngOnInit(): void {} 12 | } 13 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/features/admin/admin-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | import { AdminComponent } from './admin.component'; 5 | 6 | const routes: Routes = [{ path: '', component: AdminComponent }]; 7 | 8 | @NgModule({ 9 | imports: [RouterModule.forChild(routes)], 10 | exports: [RouterModule] 11 | }) 12 | export class AdminRoutingModule {} 13 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/features/admin/admin.component.html: -------------------------------------------------------------------------------- 1 | 2 |

Admin

3 | 4 | 5 |
6 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/features/admin/admin.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomastrajan/angular-architecture-example/3a66b65dee1ef5a0771afea5bcf6bdeb1e40235b/projects/my-epic-app/src/app/features/admin/admin.component.scss -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/features/admin/admin.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | import { NoopAnimationsModule } from '@angular/platform-browser/animations'; 3 | 4 | import { SharedModule } from '../../shared/shared.module'; 5 | 6 | import { AdminComponent } from './admin.component'; 7 | 8 | describe('AdminComponent', () => { 9 | let component: AdminComponent; 10 | let fixture: ComponentFixture; 11 | 12 | beforeEach(async(() => { 13 | TestBed.configureTestingModule({ 14 | imports: [SharedModule, NoopAnimationsModule], 15 | declarations: [AdminComponent] 16 | }).compileComponents(); 17 | })); 18 | 19 | beforeEach(() => { 20 | fixture = TestBed.createComponent(AdminComponent); 21 | component = fixture.componentInstance; 22 | fixture.detectChanges(); 23 | }); 24 | 25 | it('should create', () => { 26 | expect(component).toBeTruthy(); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/features/admin/admin.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'my-org-admin', 5 | templateUrl: './admin.component.html', 6 | styleUrls: ['./admin.component.scss'] 7 | }) 8 | export class AdminComponent implements OnInit { 9 | constructor() {} 10 | 11 | ngOnInit(): void {} 12 | } 13 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/features/admin/admin.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | 3 | import { SharedModule } from '../../shared/shared.module'; 4 | 5 | import { AdminRoutingModule } from './admin-routing.module'; 6 | import { AdminComponent } from './admin.component'; 7 | 8 | @NgModule({ 9 | declarations: [AdminComponent], 10 | imports: [SharedModule, AdminRoutingModule] 11 | }) 12 | export class AdminModule {} 13 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/features/home/home-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | import { HomeComponent } from './home.component'; 5 | 6 | const routes: Routes = [{ path: '', component: HomeComponent }]; 7 | 8 | @NgModule({ 9 | imports: [RouterModule.forChild(routes)], 10 | exports: [RouterModule] 11 | }) 12 | export class HomeRoutingModule {} 13 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/features/home/home.component.html: -------------------------------------------------------------------------------- 1 |

Home

2 | 3 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/features/home/home.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomastrajan/angular-architecture-example/3a66b65dee1ef5a0771afea5bcf6bdeb1e40235b/projects/my-epic-app/src/app/features/home/home.component.scss -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/features/home/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | import { NoopAnimationsModule } from '@angular/platform-browser/animations'; 3 | 4 | import { SharedModule } from '../../shared/shared.module'; 5 | 6 | import { HomeComponent } from './home.component'; 7 | 8 | describe('HomeComponent', () => { 9 | let component: HomeComponent; 10 | let fixture: ComponentFixture; 11 | 12 | beforeEach(async(() => { 13 | TestBed.configureTestingModule({ 14 | imports: [SharedModule, NoopAnimationsModule], 15 | declarations: [HomeComponent] 16 | }).compileComponents(); 17 | })); 18 | 19 | beforeEach(() => { 20 | fixture = TestBed.createComponent(HomeComponent); 21 | component = fixture.componentInstance; 22 | fixture.detectChanges(); 23 | }); 24 | 25 | it('should create', () => { 26 | expect(component).toBeTruthy(); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/features/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'my-org-home', 5 | templateUrl: './home.component.html', 6 | styleUrls: ['./home.component.scss'] 7 | }) 8 | export class HomeComponent implements OnInit { 9 | constructor() {} 10 | 11 | ngOnInit(): void {} 12 | } 13 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/features/home/home.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | 3 | import { SharedModule } from '../../shared/shared.module'; 4 | 5 | import { HomeRoutingModule } from './home-routing.module'; 6 | import { HomeComponent } from './home.component'; 7 | 8 | @NgModule({ 9 | declarations: [HomeComponent], 10 | imports: [SharedModule, HomeRoutingModule] 11 | }) 12 | export class HomeModule {} 13 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/shared/shared.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { MatCardModule } from '@angular/material/card'; 4 | import { MatButtonModule } from '@angular/material/button'; 5 | 6 | import { TagListComponent } from './tag-list/tag-list.component'; 7 | import { RouterModule } from '@angular/router'; 8 | 9 | @NgModule({ 10 | declarations: [TagListComponent], 11 | imports: [ 12 | // vendor 13 | CommonModule, 14 | RouterModule, 15 | 16 | // material 17 | MatCardModule, 18 | MatButtonModule 19 | ], 20 | exports: [ 21 | // vendor 22 | CommonModule, 23 | RouterModule, 24 | 25 | // material 26 | MatCardModule, 27 | MatButtonModule, 28 | 29 | // local 30 | TagListComponent 31 | ] 32 | }) 33 | export class SharedModule {} 34 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/shared/tag-list/tag-list.component.html: -------------------------------------------------------------------------------- 1 |

tag-list works!

2 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/shared/tag-list/tag-list.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomastrajan/angular-architecture-example/3a66b65dee1ef5a0771afea5bcf6bdeb1e40235b/projects/my-epic-app/src/app/shared/tag-list/tag-list.component.scss -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/shared/tag-list/tag-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { TagListComponent } from './tag-list.component'; 4 | 5 | describe('TagListComponent', () => { 6 | let component: TagListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [TagListComponent] 12 | }).compileComponents(); 13 | })); 14 | 15 | beforeEach(() => { 16 | fixture = TestBed.createComponent(TagListComponent); 17 | component = fixture.componentInstance; 18 | fixture.detectChanges(); 19 | }); 20 | 21 | it('should create', () => { 22 | expect(component).toBeTruthy(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/app/shared/tag-list/tag-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'my-org-tag-list', 5 | templateUrl: './tag-list.component.html', 6 | styleUrls: ['./tag-list.component.scss'] 7 | }) 8 | export class TagListComponent implements OnInit { 9 | constructor() {} 10 | 11 | ngOnInit(): void {} 12 | } 13 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomastrajan/angular-architecture-example/3a66b65dee1ef5a0771afea5bcf6bdeb1e40235b/projects/my-epic-app/src/assets/.gitkeep -------------------------------------------------------------------------------- /projects/my-epic-app/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /projects/my-epic-app/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 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomastrajan/angular-architecture-example/3a66b65dee1ef5a0771afea5bcf6bdeb1e40235b/projects/my-epic-app/src/favicon.ico -------------------------------------------------------------------------------- /projects/my-epic-app/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MyEpicApp 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /projects/my-epic-app/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 | platformBrowserDynamic() 12 | .bootstrapModule(AppModule) 13 | .catch(err => console.error(err)); 14 | -------------------------------------------------------------------------------- /projects/my-epic-app/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'; 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 | * APPLICATION IMPORTS 62 | */ 63 | -------------------------------------------------------------------------------- /projects/my-epic-app/src/styles.scss: -------------------------------------------------------------------------------- 1 | // Custom Theming for Angular Material 2 | // For more information: https://material.angular.io/guide/theming 3 | @import '~@angular/material/theming'; 4 | // Plus imports for other components in your app. 5 | 6 | // Include the common styles for Angular Material. We include this here so that you only 7 | // have to load a single css file for Angular Material in your app. 8 | // Be sure that you only ever include this mixin once! 9 | @include mat-core(); 10 | 11 | // Define the palettes for your theme using the Material Design palettes available in palette.scss 12 | // (imported above). For each palette, you can optionally specify a default, lighter, and darker 13 | // hue. Available color palettes: https://material.io/design/color/ 14 | $my-epic-app-primary: mat-palette($mat-indigo); 15 | $my-epic-app-accent: mat-palette($mat-pink, A200, A100, A400); 16 | 17 | // The warn palette is optional (defaults to red). 18 | $my-epic-app-warn: mat-palette($mat-red); 19 | 20 | // Create the theme object (a Sass map containing all of the palettes). 21 | $my-epic-app-theme: mat-light-theme( 22 | $my-epic-app-primary, 23 | $my-epic-app-accent, 24 | $my-epic-app-warn 25 | ); 26 | 27 | // Include theme styles for core and each component used in your app. 28 | // Alternatively, you can import and @include the theme mixins for each component 29 | // that you are using. 30 | @include angular-material-theme($my-epic-app-theme); 31 | 32 | /* You can add global styles to this file, and also import other style files */ 33 | 34 | html, 35 | body { 36 | height: 100%; 37 | } 38 | body { 39 | margin: 0; 40 | font-family: Roboto, 'Helvetica Neue', sans-serif; 41 | } 42 | -------------------------------------------------------------------------------- /projects/my-epic-app/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: { 11 | context( 12 | path: string, 13 | deep?: boolean, 14 | filter?: RegExp 15 | ): { 16 | keys(): string[]; 17 | (id: string): T; 18 | }; 19 | }; 20 | 21 | // First, initialize the Angular testing environment. 22 | getTestBed().initTestEnvironment( 23 | BrowserDynamicTestingModule, 24 | platformBrowserDynamicTesting() 25 | ); 26 | // Then we find all the tests. 27 | const context = require.context('./', true, /\.spec\.ts$/); 28 | // And load the modules. 29 | context.keys().map(context); 30 | -------------------------------------------------------------------------------- /projects/my-epic-app/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/app", 5 | "types": [] 6 | }, 7 | "files": ["src/main.ts", "src/polyfills.ts"], 8 | "include": ["src/**/*.d.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /projects/my-epic-app/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/spec", 5 | "types": ["jasmine", "node"] 6 | }, 7 | "files": ["src/test.ts", "src/polyfills.ts"], 8 | "include": ["src/**/*.spec.ts", "src/**/*.d.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /projects/my-epic-app/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tslint.json", 3 | "rules": { 4 | "directive-selector": [true, "attribute", "myOrg", "camelCase"], 5 | "component-selector": [true, "element", "my-org", "kebab-case"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "noImplicitAny": true, 7 | "noImplicitReturns": true, 8 | "noImplicitThis": true, 9 | "noFallthroughCasesInSwitch": true, 10 | "strictNullChecks": true, 11 | "sourceMap": true, 12 | "declaration": false, 13 | "downlevelIteration": true, 14 | "experimentalDecorators": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "importHelpers": true, 18 | "target": "es2015", 19 | "typeRoots": [ 20 | "node_modules/@types" 21 | ], 22 | "lib": [ 23 | "es2018", 24 | "dom" 25 | ] 26 | }, 27 | "angularCompilerOptions": { 28 | "fullTemplateTypeCheck": true, 29 | "strictInjectionParameters": true 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["tslint:recommended", "tslint-config-prettier"], 3 | "rulesDirectory": [ 4 | "codelyzer" 5 | ], 6 | "rules": { 7 | "array-type": false, 8 | "arrow-parens": false, 9 | "deprecation": { 10 | "severity": "warning" 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-var-requires": false, 52 | "object-literal-key-quotes": [ 53 | true, 54 | "as-needed" 55 | ], 56 | "object-literal-sort-keys": false, 57 | "ordered-imports": false, 58 | "quotemark": [ 59 | true, 60 | "single" 61 | ], 62 | "trailing-comma": false, 63 | "component-class-suffix": true, 64 | "contextual-lifecycle": true, 65 | "directive-class-suffix": true, 66 | "no-conflicting-lifecycle": true, 67 | "no-host-metadata-property": true, 68 | "no-input-rename": true, 69 | "no-inputs-metadata-property": true, 70 | "no-output-native": true, 71 | "no-output-on-prefix": true, 72 | "no-output-rename": true, 73 | "no-outputs-metadata-property": true, 74 | "template-banana-in-box": true, 75 | "template-no-negated-async": true, 76 | "use-lifecycle-interface": true, 77 | "use-pipe-transform-interface": true 78 | } 79 | } 80 | --------------------------------------------------------------------------------