├── APM ├── .editorconfig ├── .gitignore ├── .vscode │ └── settings.json ├── angular.json ├── browserslist ├── e2e │ ├── protractor.conf.js │ ├── src │ │ ├── app.e2e-spec.ts │ │ └── app.po.ts │ └── tsconfig.json ├── karma.conf.js ├── package.json ├── readme.md ├── src │ ├── app │ │ ├── app-routing.module.ts │ │ ├── app.component.css │ │ ├── app.component.html │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── home │ │ │ ├── welcome.component.html │ │ │ └── welcome.component.ts │ │ ├── page-not-found.component.ts │ │ ├── products │ │ │ ├── product-data.ts │ │ │ ├── product-detail.component.css │ │ │ ├── product-detail.component.html │ │ │ ├── product-detail.component.ts │ │ │ ├── product-list.component.css │ │ │ ├── product-list.component.html │ │ │ ├── product-list.component.ts │ │ │ ├── product.module.ts │ │ │ ├── product.service.ts │ │ │ └── product.ts │ │ └── shared │ │ │ ├── shared.module.ts │ │ │ ├── star.component.css │ │ │ ├── star.component.html │ │ │ └── star.component.ts │ ├── assets │ │ ├── .gitkeep │ │ └── images │ │ │ ├── ball.png │ │ │ ├── evenstar.jpg │ │ │ ├── garden_cart.png │ │ │ ├── hammer.png │ │ │ ├── leaf_rake.png │ │ │ ├── logo.jpg │ │ │ ├── palantir.jpg │ │ │ ├── ring.jpg │ │ │ ├── rope.png │ │ │ ├── saw.png │ │ │ ├── sword.png │ │ │ ├── sword2.png │ │ │ ├── sword3.png │ │ │ └── xbox-controller.png │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ ├── styles.css │ └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json └── tslint.json ├── LICENSE └── README.md /APM/.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 | -------------------------------------------------------------------------------- /APM/.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 | -------------------------------------------------------------------------------- /APM/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.autoSave": "afterDelay", 3 | "html.format.wrapAttributes": "force-aligned", 4 | "workbench.colorCustomizations": {} 5 | } -------------------------------------------------------------------------------- /APM/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "APM": { 7 | "projectType": "application", 8 | "schematics": {}, 9 | "root": "", 10 | "sourceRoot": "src", 11 | "prefix": "pm", 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:browser", 15 | "options": { 16 | "outputPath": "dist/APM", 17 | "index": "src/index.html", 18 | "main": "src/main.ts", 19 | "polyfills": "src/polyfills.ts", 20 | "tsConfig": "tsconfig.app.json", 21 | "aot": true, 22 | "assets": [ 23 | "src/favicon.ico", 24 | "src/assets" 25 | ], 26 | "styles": [ 27 | "src/styles.css" 28 | ], 29 | "scripts": [] 30 | }, 31 | "configurations": { 32 | "production": { 33 | "fileReplacements": [ 34 | { 35 | "replace": "src/environments/environment.ts", 36 | "with": "src/environments/environment.prod.ts" 37 | } 38 | ], 39 | "optimization": true, 40 | "outputHashing": "all", 41 | "sourceMap": false, 42 | "extractCss": true, 43 | "namedChunks": false, 44 | "extractLicenses": true, 45 | "vendorChunk": false, 46 | "buildOptimizer": true, 47 | "budgets": [ 48 | { 49 | "type": "initial", 50 | "maximumWarning": "2mb", 51 | "maximumError": "5mb" 52 | }, 53 | { 54 | "type": "anyComponentStyle", 55 | "maximumWarning": "6kb", 56 | "maximumError": "10kb" 57 | } 58 | ] 59 | } 60 | } 61 | }, 62 | "serve": { 63 | "builder": "@angular-devkit/build-angular:dev-server", 64 | "options": { 65 | "browserTarget": "APM:build" 66 | }, 67 | "configurations": { 68 | "production": { 69 | "browserTarget": "APM:build:production" 70 | } 71 | } 72 | }, 73 | "extract-i18n": { 74 | "builder": "@angular-devkit/build-angular:extract-i18n", 75 | "options": { 76 | "browserTarget": "APM:build" 77 | } 78 | }, 79 | "test": { 80 | "builder": "@angular-devkit/build-angular:karma", 81 | "options": { 82 | "main": "src/test.ts", 83 | "polyfills": "src/polyfills.ts", 84 | "tsConfig": "tsconfig.spec.json", 85 | "karmaConfig": "karma.conf.js", 86 | "assets": [ 87 | "src/favicon.ico", 88 | "src/assets" 89 | ], 90 | "styles": [ 91 | "src/styles.css" 92 | ], 93 | "scripts": [] 94 | } 95 | }, 96 | "lint": { 97 | "builder": "@angular-devkit/build-angular:tslint", 98 | "options": { 99 | "tsConfig": [ 100 | "tsconfig.app.json", 101 | "tsconfig.spec.json", 102 | "e2e/tsconfig.json" 103 | ], 104 | "exclude": [ 105 | "**/node_modules/**" 106 | ] 107 | } 108 | }, 109 | "e2e": { 110 | "builder": "@angular-devkit/build-angular:protractor", 111 | "options": { 112 | "protractorConfig": "e2e/protractor.conf.js", 113 | "devServerTarget": "APM:serve" 114 | }, 115 | "configurations": { 116 | "production": { 117 | "devServerTarget": "APM:serve:production" 118 | } 119 | } 120 | } 121 | } 122 | } 123 | }, 124 | "defaultProject": "APM", 125 | "cli": { 126 | "analytics": "29397dfc-411e-4cf7-a628-4423025bbc56" 127 | } 128 | } -------------------------------------------------------------------------------- /APM/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'. -------------------------------------------------------------------------------- /APM/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 | }; -------------------------------------------------------------------------------- /APM/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 APM!'); 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 | -------------------------------------------------------------------------------- /APM/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('pm-root h1')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /APM/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /APM/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/APM'), 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 | -------------------------------------------------------------------------------- /APM/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "apm", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve -o", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "~9.0.0", 15 | "@angular/common": "~9.0.0", 16 | "@angular/compiler": "~9.0.0", 17 | "@angular/core": "~9.0.0", 18 | "@angular/forms": "~9.0.0", 19 | "@angular/platform-browser": "~9.0.0", 20 | "@angular/platform-browser-dynamic": "~9.0.0", 21 | "@angular/router": "~9.0.0", 22 | "bootstrap": "^4.3.1", 23 | "font-awesome": "^4.7.0", 24 | "rxjs": "~6.4.0", 25 | "tslib": "^1.10.0", 26 | "zone.js": "~0.10.2" 27 | }, 28 | "devDependencies": { 29 | "@angular-devkit/build-angular": "~0.900.1", 30 | "@angular/cli": "~9.0.1", 31 | "@angular/compiler-cli": "~9.0.0", 32 | "@angular/language-service": "~9.0.0", 33 | "@types/node": "^12.11.1", 34 | "@types/jasmine": "~3.3.8", 35 | "@types/jasminewd2": "~2.0.3", 36 | "angular-in-memory-web-api": "^0.9.0", 37 | "codelyzer": "^5.1.2", 38 | "jasmine-core": "~3.4.0", 39 | "jasmine-spec-reporter": "~4.2.1", 40 | "karma": "~4.1.0", 41 | "karma-chrome-launcher": "~2.2.0", 42 | "karma-coverage-istanbul-reporter": "~2.0.1", 43 | "karma-jasmine": "~2.0.1", 44 | "karma-jasmine-html-reporter": "^1.4.0", 45 | "protractor": "~5.4.0", 46 | "ts-node": "~7.0.0", 47 | "tslint": "~5.15.0", 48 | "typescript": "~3.7.5" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /APM/readme.md: -------------------------------------------------------------------------------- 1 | # APM 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.1. 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 | -------------------------------------------------------------------------------- /APM/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | 4 | import { WelcomeComponent } from './home/welcome.component'; 5 | import { PageNotFoundComponent } from './page-not-found.component'; 6 | 7 | @NgModule({ 8 | imports: [ 9 | RouterModule.forRoot([ 10 | { path: 'welcome', component: WelcomeComponent }, 11 | { 12 | path: 'products', 13 | data: { preload: false }, 14 | loadChildren: () => 15 | import('./products/product.module').then(m => m.ProductModule) 16 | }, 17 | { path: '', redirectTo: 'welcome', pathMatch: 'full' }, 18 | { path: '**', component: PageNotFoundComponent } 19 | ]) 20 | ], 21 | exports: [RouterModule] 22 | }) 23 | export class AppRoutingModule { } 24 | -------------------------------------------------------------------------------- /APM/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | .nav-link { 2 | font-size: large; 3 | cursor: pointer; 4 | } 5 | 6 | .navbar-light .navbar-nav .nav-link.active { 7 | color: #007ACC 8 | } 9 | 10 | /* Spinner */ 11 | .spinner { 12 | font-size:300%; 13 | position:absolute; 14 | top: 50%; 15 | left: 50%; 16 | z-index:10 17 | } 18 | 19 | .fa-spinner { 20 | -webkit-animation: spin 1000ms infinite linear; 21 | animation: spin 1000ms infinite linear; 22 | } 23 | -------------------------------------------------------------------------------- /APM/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 21 | 22 |
23 |
24 |
25 | 26 |
27 |
28 |
-------------------------------------------------------------------------------- /APM/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { Router, Event, NavigationStart, NavigationEnd, NavigationError, NavigationCancel } from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'pm-root', 6 | templateUrl: './app.component.html', 7 | styleUrls: ['./app.component.css'] 8 | }) 9 | export class AppComponent { 10 | pageTitle = 'Acme Product Management'; 11 | loading = true; 12 | 13 | constructor(private router: Router) { 14 | router.events.subscribe((routerEvent: Event) => { 15 | this.checkRouterEvent(routerEvent); 16 | }); 17 | } 18 | 19 | checkRouterEvent(routerEvent: Event): void { 20 | if (routerEvent instanceof NavigationStart) { 21 | this.loading = true; 22 | } 23 | 24 | if (routerEvent instanceof NavigationEnd || 25 | routerEvent instanceof NavigationCancel || 26 | routerEvent instanceof NavigationError) { 27 | this.loading = false; 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /APM/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { HttpClientModule } from '@angular/common/http'; 4 | 5 | // Imports for loading & configuring the in-memory web api 6 | import { InMemoryWebApiModule } from 'angular-in-memory-web-api'; 7 | import { ProductData } from './products/product-data'; 8 | 9 | import { AppRoutingModule } from './app-routing.module'; 10 | import { AppComponent } from './app.component'; 11 | import { WelcomeComponent } from './home/welcome.component'; 12 | import { PageNotFoundComponent } from './page-not-found.component'; 13 | 14 | @NgModule({ 15 | imports: [ 16 | BrowserModule, 17 | HttpClientModule, 18 | InMemoryWebApiModule.forRoot(ProductData), 19 | AppRoutingModule 20 | ], 21 | declarations: [ 22 | AppComponent, 23 | WelcomeComponent, 24 | PageNotFoundComponent 25 | ], 26 | bootstrap: [AppComponent] 27 | }) 28 | export class AppModule { } 29 | -------------------------------------------------------------------------------- /APM/src/app/home/welcome.component.html: -------------------------------------------------------------------------------- 1 | 
2 |
3 | {{pageTitle}} 4 |
5 |
6 |
7 |
8 | 11 |
12 | 13 |
Developed by:
14 |
15 |

Deborah Kurata

16 |
17 | 18 |
@deborahkurata
19 | 22 |
23 |
24 |
-------------------------------------------------------------------------------- /APM/src/app/home/welcome.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | templateUrl: './welcome.component.html' 5 | }) 6 | export class WelcomeComponent { 7 | public pageTitle = 'Welcome'; 8 | } 9 | -------------------------------------------------------------------------------- /APM/src/app/page-not-found.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | template: ` 5 |

This is not the page you were looking for!

6 | ` 7 | }) 8 | export class PageNotFoundComponent { } 9 | -------------------------------------------------------------------------------- /APM/src/app/products/product-data.ts: -------------------------------------------------------------------------------- 1 | import { InMemoryDbService } from 'angular-in-memory-web-api'; 2 | 3 | import { Product } from './product'; 4 | 5 | export interface ProductResponse { 6 | data: Product [] 7 | } 8 | 9 | export class ProductData implements InMemoryDbService { 10 | 11 | createDb() { 12 | // Used to demo mapping of a "data" property 13 | const productList: ProductResponse = { data: [ 14 | { 15 | id: 1, 16 | productName: 'Palantir', 17 | productCode: 'COM-0011', 18 | releaseDate: 'March 19, 2018', 19 | description: 'Genuine seeing stone', 20 | price: 1900.95, 21 | cost: 1599.0, 22 | starRating: 3.2, 23 | imageUrl: 'assets/images/palantir.jpg', 24 | category: 'Communications', 25 | tags: ['ball', 'phone'] 26 | }, 27 | { 28 | id: 2, 29 | productName: 'Rope', 30 | productCode: 'CMP-0023', 31 | releaseDate: 'March 18, 2018', 32 | description: 'Elvin rope', 33 | price: 32.99, 34 | cost: 10.00, 35 | starRating: 4.2, 36 | imageUrl: 'assets/images/rope.png', 37 | category: 'Camping' 38 | }, 39 | { 40 | id: 5, 41 | productName: 'Sword', 42 | productCode: 'WEA-0048', 43 | releaseDate: 'May 21, 2018', 44 | description: 'Flame of the West', 45 | price: 849.9, 46 | cost: 520.0, 47 | starRating: 4.9, 48 | imageUrl: 'assets/images/sword.png', 49 | category: 'Weapons', 50 | tags: ['weapons', 'battle', 'elven'] 51 | }, 52 | { 53 | id: 8, 54 | productName: 'Ring', 55 | productCode: 'JWL-0022', 56 | releaseDate: 'May 15, 2018', 57 | description: 'The one ring', 58 | price: 111.55, 59 | cost: 60.0, 60 | starRating: 2.7, 61 | imageUrl: 'assets/images/ring.jpg', 62 | category: 'Jewelry' 63 | }, 64 | { 65 | id: 10, 66 | productName: 'Evenstar', 67 | productCode: 'JWL-0042', 68 | releaseDate: 'October 15, 2018', 69 | description: 'Brilliant Elfstone jewel', 70 | price: 3500.95, 71 | cost: 2100.18, 72 | starRating: 4.9, 73 | imageUrl: 'assets/images/evenstar.jpg', 74 | category: 'Jewelry' 75 | } 76 | ]}; 77 | 78 | // Used to retrieve individual items 79 | const products: Product[] = [ 80 | { 81 | id: 1, 82 | productName: 'Palantir', 83 | productCode: 'COM-0011', 84 | releaseDate: 'March 19, 2018', 85 | description: 'Genuine seeing stone', 86 | price: 1900.95, 87 | cost: 1599.0, 88 | starRating: 3.2, 89 | imageUrl: 'assets/images/palantir.jpg', 90 | category: 'Communications', 91 | tags: ['ball', 'phone'] 92 | }, 93 | { 94 | id: 2, 95 | productName: 'Rope', 96 | productCode: 'CMP-0023', 97 | releaseDate: 'March 18, 2018', 98 | description: 'Elvin rope', 99 | price: 32.99, 100 | cost: 10.00, 101 | starRating: 4.2, 102 | imageUrl: 'assets/images/rope.png', 103 | category: 'Camping' 104 | }, 105 | { 106 | id: 5, 107 | productName: 'Sword', 108 | productCode: 'WEA-0048', 109 | releaseDate: 'May 21, 2018', 110 | description: 'Flame of the West', 111 | price: 849.9, 112 | cost: 520.0, 113 | starRating: 4.9, 114 | imageUrl: 'assets/images/sword.png', 115 | category: 'Weapons', 116 | tags: ['weapons', 'battle', 'elven'] 117 | }, 118 | { 119 | id: 8, 120 | productName: 'Ring', 121 | productCode: 'JWL-0022', 122 | releaseDate: 'May 15, 2018', 123 | description: 'The one ring', 124 | price: 111.55, 125 | cost: 60.0, 126 | starRating: 2.7, 127 | imageUrl: 'assets/images/ring.jpg', 128 | category: 'Jewelry' 129 | }, 130 | { 131 | id: 10, 132 | productName: 'Evenstar', 133 | productCode: 'JWL-0042', 134 | releaseDate: 'October 15, 2018', 135 | description: 'Brilliant Elfstone jewel', 136 | price: 3500.95, 137 | cost: 2100.18, 138 | starRating: 4.9, 139 | imageUrl: 'assets/images/evenstar.jpg', 140 | category: 'Jewelry' 141 | } 142 | ]; 143 | 144 | return { productList, products }; 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /APM/src/app/products/product-detail.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/app/products/product-detail.component.css -------------------------------------------------------------------------------- /APM/src/app/products/product-detail.component.html: -------------------------------------------------------------------------------- 1 |
2 |
4 | {{pageTitle}} 5 |
6 | 7 |
9 | 10 |
11 | 12 |
13 |
14 |
Name:
15 |
{{product.productName}}
16 |
17 |
18 |
Code:
19 |
{{product.productCode}}
20 |
21 |
22 |
Description:
23 |
{{product.description}}
24 |
25 |
26 |
Availability:
27 |
{{product.releaseDate}}
28 |
29 |
30 |
Price:
31 |
{{product.price|currency:"USD":"symbol"}}
32 |
33 |
34 |
Cost:
35 |
{{product.cost|currency:"USD":"symbol"}}
36 |
37 |
38 |
Profit:
39 |
{{product.profit|currency:"USD":"symbol"}}
40 |
41 |
42 |
5 Star Rating:
43 |
44 | 45 | 46 |
47 |
48 |
49 |
Category:
50 |
{{product.category}}
51 |
52 |
53 |
Tags:
54 |
{{product.tags}}
55 |
56 |
57 | 58 |
60 | 65 |
66 |
67 | 68 |
69 |
70 | 76 |
77 |
78 | 79 |
80 |
81 | 82 |
{{errorMessage}} 84 |
-------------------------------------------------------------------------------- /APM/src/app/products/product-detail.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | 4 | import { EMPTY } from 'rxjs'; 5 | import { catchError, map, tap } from 'rxjs/operators'; 6 | 7 | import { ProductService } from './product.service'; 8 | import { Product } from './product'; 9 | 10 | @Component({ 11 | templateUrl: './product-detail.component.html', 12 | styleUrls: ['./product-detail.component.css'], 13 | changeDetection: ChangeDetectionStrategy.OnPush 14 | }) 15 | export class ProductDetailComponent implements OnInit { 16 | errorMessage = ''; 17 | 18 | product$ = this.productService.product$ 19 | .pipe( 20 | catchError(error => { 21 | this.errorMessage = error; 22 | return EMPTY; 23 | })); 24 | 25 | pageTitle$ = this.product$ 26 | .pipe( 27 | map((p: Product) => 28 | p ? `Product Detail for: ${p.productName}` : null) 29 | ); 30 | 31 | constructor(private route: ActivatedRoute, 32 | private productService: ProductService) { } 33 | 34 | ngOnInit(): void { 35 | const param = this.route.snapshot.paramMap.get('id'); 36 | if (param) { 37 | this.productService.changeSelectedProduct(+param); 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /APM/src/app/products/product-list.component.css: -------------------------------------------------------------------------------- 1 | thead { 2 | color: #337AB7; 3 | } -------------------------------------------------------------------------------- /APM/src/app/products/product-list.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | {{pageTitle}} 4 |
5 | 6 |
7 |
8 |
Filter by:
9 |
10 | 13 |
14 |
15 |
17 |
18 |

Filtered by: {{listFilter}}

19 |
20 |
21 | 22 |
23 | 25 | 26 | 27 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 50 | 56 | 57 | 58 | 59 | 63 | 68 | 69 | 70 |
28 | 32 | ProductCodeAvailablePrice5 Star Rating
44 | 49 | 51 | 53 | {{ product.productName }} 54 | 55 | {{ product.productCode }}{{ product.releaseDate }}{{ product.price | currency:"USD":"symbol":"1.2-2" }} 60 | 61 | 62 | 64 | 67 |
71 |
72 | 73 |
74 |
75 | 76 |
78 | Error: {{ errorMessage }} 79 |
-------------------------------------------------------------------------------- /APM/src/app/products/product-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | 4 | import { BehaviorSubject, combineLatest, EMPTY } from 'rxjs'; 5 | import { catchError, map, tap } from 'rxjs/operators'; 6 | 7 | import { ProductService } from './product.service'; 8 | import { Product } from './product'; 9 | 10 | @Component({ 11 | templateUrl: './product-list.component.html', 12 | styleUrls: ['./product-list.component.css'], 13 | changeDetection: ChangeDetectionStrategy.OnPush 14 | }) 15 | export class ProductListComponent implements OnInit { 16 | pageTitle = 'Product List'; 17 | imageWidth = 50; 18 | imageMargin = 2; 19 | showImage = false; 20 | errorMessage = ''; 21 | listFilter = ''; 22 | 23 | filterSubject = new BehaviorSubject(''); 24 | filterAction$ = this.filterSubject.asObservable(); 25 | 26 | allProducts$ = this.productService.products$ 27 | .pipe( 28 | catchError(error => { 29 | this.errorMessage = error; 30 | return EMPTY; 31 | })); 32 | 33 | products$ = combineLatest([ 34 | this.allProducts$, 35 | this.filterAction$]) 36 | .pipe( 37 | // Retain the current filter in a string for binding 38 | tap(([, filter]) => this.listFilter = filter), 39 | // Perform the filtering 40 | map(([products, filter]) => this.performFilter(products, filter)), 41 | ); 42 | 43 | constructor(private productService: ProductService, 44 | private route: ActivatedRoute) { } 45 | 46 | ngOnInit(): void { 47 | this.filterSubject.next(this.route.snapshot.queryParamMap.get('filterBy') || ''); 48 | this.showImage = this.route.snapshot.queryParamMap.get('showImage') === 'true'; 49 | } 50 | 51 | performFilter(products: Product[], filterBy: string) { 52 | filterBy = filterBy.toLocaleLowerCase(); 53 | return products.filter((product: Product) => 54 | product.productName.toLocaleLowerCase().indexOf(filterBy) !== -1); 55 | } 56 | 57 | toggleImage(): void { 58 | this.showImage = !this.showImage; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /APM/src/app/products/product.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | 4 | import { ProductListComponent } from './product-list.component'; 5 | import { ProductDetailComponent } from './product-detail.component'; 6 | 7 | import { SharedModule } from '../shared/shared.module'; 8 | 9 | @NgModule({ 10 | imports: [ 11 | SharedModule, 12 | RouterModule.forChild([ 13 | { 14 | path: '', 15 | component: ProductListComponent 16 | }, 17 | { 18 | path: ':id', 19 | component: ProductDetailComponent, 20 | } 21 | ]) 22 | ], 23 | declarations: [ 24 | ProductListComponent, 25 | ProductDetailComponent 26 | ] 27 | }) 28 | export class ProductModule { } 29 | -------------------------------------------------------------------------------- /APM/src/app/products/product.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | 4 | import { combineLatest, Observable, BehaviorSubject, throwError } from 'rxjs'; 5 | import { catchError, tap, map, switchMap, filter, shareReplay } from 'rxjs/operators'; 6 | 7 | import { Product } from './product'; 8 | import { ProductResponse } from './product-data'; 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class ProductService { 14 | private productListUrl = 'api/productList'; 15 | private productsUrl = 'api/products'; 16 | 17 | // List of products 18 | products$ = this.http.get(this.productListUrl) 19 | .pipe( 20 | tap(response => console.log(JSON.stringify(response))), 21 | map(response => response.data), 22 | shareReplay(1), 23 | catchError(this.handleError) 24 | ); 25 | 26 | private productSelectedSubject = new BehaviorSubject(0); 27 | productSelectedAction$ = this.productSelectedSubject.asObservable(); 28 | 29 | // Simple map doesn't work 30 | productWithMap$ = this.productSelectedAction$ 31 | .pipe( 32 | map(selectedProductId => 33 | this.http.get(`${this.productsUrl}/${selectedProductId}`) 34 | .pipe( 35 | tap(response => console.log(JSON.stringify(response))), 36 | map(p => ({ ...p, profit: p.price - p.cost }) as Product), 37 | catchError(this.handleError) 38 | ) 39 | )); 40 | 41 | // Try mergeMap, switchMap, concatMap 42 | product$ = this.productSelectedAction$ 43 | .pipe( 44 | filter(id => !!id), 45 | switchMap(selectedProductId => 46 | this.http.get(`${this.productsUrl}/${selectedProductId}`) 47 | .pipe( 48 | tap(response => console.log(JSON.stringify(response))), 49 | map(p => ({ ...p, profit: p.price - p.cost }) as Product), 50 | catchError(this.handleError) 51 | ) 52 | )); 53 | 54 | // Mapping of one product 55 | product1$ = this.http.get(`${this.productsUrl}/1`) 56 | .pipe( 57 | map(p => ({ ...p, profit: p.price - p.cost }) as Product), 58 | catchError(this.handleError) 59 | ); 60 | 61 | constructor(private http: HttpClient) { } 62 | 63 | changeSelectedProduct(selectedProductId: number): void { 64 | this.productSelectedSubject.next(selectedProductId); 65 | } 66 | 67 | private handleError(err: any) { 68 | // in a real world app, we may send the server to some remote logging infrastructure 69 | // instead of just logging it to the console 70 | let errorMessage: string; 71 | if (err.error instanceof ErrorEvent) { 72 | // A client-side or network error occurred. Handle it accordingly. 73 | errorMessage = `An error occurred: ${err.error.message}`; 74 | } else { 75 | // The backend returned an unsuccessful response code. 76 | // The response body may contain clues as to what went wrong, 77 | errorMessage = `Backend returned code ${err.status}: ${err.body.error}`; 78 | } 79 | console.error(err); 80 | return throwError(errorMessage); 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /APM/src/app/products/product.ts: -------------------------------------------------------------------------------- 1 | /* Defines the product entity */ 2 | export interface Product { 3 | id: number; 4 | productName: string; 5 | productCode: string; 6 | category: string; 7 | tags?: string[]; 8 | releaseDate: string; 9 | price: number; 10 | cost: number; 11 | profit?: number, 12 | description: string; 13 | starRating: number; 14 | imageUrl: string; 15 | } 16 | -------------------------------------------------------------------------------- /APM/src/app/shared/shared.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule } from '@angular/forms'; 4 | 5 | import { StarComponent } from './star.component'; 6 | 7 | @NgModule({ 8 | imports: [ 9 | CommonModule 10 | ], 11 | declarations: [ 12 | StarComponent 13 | ], 14 | exports: [ 15 | StarComponent, 16 | CommonModule, 17 | FormsModule 18 | ] 19 | }) 20 | export class SharedModule { } 21 | -------------------------------------------------------------------------------- /APM/src/app/shared/star.component.css: -------------------------------------------------------------------------------- 1 | .crop { 2 | overflow: hidden; 3 | } 4 | div { 5 | cursor: pointer; 6 | } -------------------------------------------------------------------------------- /APM/src/app/shared/star.component.html: -------------------------------------------------------------------------------- 1 |
5 |
6 | 7 | 8 | 9 | 10 | 11 |
12 |
-------------------------------------------------------------------------------- /APM/src/app/shared/star.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnChanges, Input, EventEmitter, Output } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'pm-star', 5 | templateUrl: './star.component.html', 6 | styleUrls: ['./star.component.css'] 7 | }) 8 | export class StarComponent implements OnChanges { 9 | @Input() rating = 0; 10 | starWidth = 0; 11 | @Output() ratingClicked: EventEmitter = 12 | new EventEmitter(); 13 | 14 | ngOnChanges(): void { 15 | this.starWidth = this.rating * 75 / 5; 16 | } 17 | 18 | onClick(): void { 19 | this.ratingClicked.emit(`The rating ${this.rating} was clicked!`); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /APM/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/assets/.gitkeep -------------------------------------------------------------------------------- /APM/src/assets/images/ball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/assets/images/ball.png -------------------------------------------------------------------------------- /APM/src/assets/images/evenstar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/assets/images/evenstar.jpg -------------------------------------------------------------------------------- /APM/src/assets/images/garden_cart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/assets/images/garden_cart.png -------------------------------------------------------------------------------- /APM/src/assets/images/hammer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/assets/images/hammer.png -------------------------------------------------------------------------------- /APM/src/assets/images/leaf_rake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/assets/images/leaf_rake.png -------------------------------------------------------------------------------- /APM/src/assets/images/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/assets/images/logo.jpg -------------------------------------------------------------------------------- /APM/src/assets/images/palantir.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/assets/images/palantir.jpg -------------------------------------------------------------------------------- /APM/src/assets/images/ring.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/assets/images/ring.jpg -------------------------------------------------------------------------------- /APM/src/assets/images/rope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/assets/images/rope.png -------------------------------------------------------------------------------- /APM/src/assets/images/saw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/assets/images/saw.png -------------------------------------------------------------------------------- /APM/src/assets/images/sword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/assets/images/sword.png -------------------------------------------------------------------------------- /APM/src/assets/images/sword2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/assets/images/sword2.png -------------------------------------------------------------------------------- /APM/src/assets/images/sword3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/assets/images/sword3.png -------------------------------------------------------------------------------- /APM/src/assets/images/xbox-controller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/assets/images/xbox-controller.png -------------------------------------------------------------------------------- /APM/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /APM/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 | -------------------------------------------------------------------------------- /APM/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeborahK/Angular-HigherOrderMapping/9cf2cabe91d9179c8e7e89c7616727fa65cedd66/APM/src/favicon.ico -------------------------------------------------------------------------------- /APM/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | APM 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /APM/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().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /APM/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 | -------------------------------------------------------------------------------- /APM/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | @import "~bootstrap/dist/css/bootstrap.min.css"; 3 | @import "~font-awesome/css/font-awesome.min.css"; 4 | 5 | div.card-header { 6 | font-size: large; 7 | } 8 | 9 | div.card { 10 | margin-top: 10px 11 | } 12 | 13 | .table { 14 | margin-top: 10px 15 | } 16 | -------------------------------------------------------------------------------- /APM/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 | -------------------------------------------------------------------------------- /APM/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/app", 5 | "types": [] 6 | }, 7 | "files": [ 8 | "src/main.ts", 9 | "src/polyfills.ts" 10 | ], 11 | "include": [ 12 | "src/**/*.d.ts" 13 | ], 14 | "exclude": [ 15 | "src/test.ts", 16 | "src/**/*.spec.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /APM/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "strict": true, 8 | "declaration": false, 9 | "downlevelIteration": true, 10 | "experimentalDecorators": true, 11 | "module": "esnext", 12 | "moduleResolution": "node", 13 | "importHelpers": true, 14 | "target": "es2015", 15 | "typeRoots": [ 16 | "node_modules/@types" 17 | ], 18 | "lib": [ 19 | "es2018", 20 | "dom" 21 | ] 22 | }, 23 | "angularCompilerOptions": { 24 | "fullTemplateTypeCheck": true, 25 | "strictInjectionParameters": true, 26 | // "strictTemplates": true 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /APM/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 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /APM/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rules": { 4 | "array-type": false, 5 | "arrow-parens": false, 6 | "ban-types": { 7 | "options": [ 8 | ["Object", "Avoid using the `Object` type. Did you mean `object`?"], 9 | ["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"], 10 | ["Number", "Avoid using the `Number` type. Did you mean `number`?"], 11 | ["String", "Avoid using the `String` type. Did you mean `string`?"], 12 | ["Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?"] 13 | ] 14 | }, 15 | "deprecation": { 16 | "severity": "warning" 17 | }, 18 | "component-class-suffix": true, 19 | "contextual-lifecycle": true, 20 | "directive-class-suffix": true, 21 | "directive-selector": [ 22 | true, 23 | "attribute", 24 | "pm", 25 | "camelCase" 26 | ], 27 | "component-selector": [ 28 | true, 29 | "element", 30 | "pm", 31 | "kebab-case" 32 | ], 33 | "import-blacklist": [ 34 | true, 35 | "rxjs/Rx" 36 | ], 37 | "interface-name": false, 38 | "max-classes-per-file": false, 39 | "max-line-length": [ 40 | true, 41 | 140 42 | ], 43 | "member-access": false, 44 | "member-ordering": [ 45 | true, 46 | { 47 | "order": [ 48 | "static-field", 49 | "instance-field", 50 | "static-method", 51 | "instance-method" 52 | ] 53 | } 54 | ], 55 | "no-consecutive-blank-lines": false, 56 | "no-console": [ 57 | true, 58 | "debug", 59 | "info", 60 | "time", 61 | "timeEnd", 62 | "trace" 63 | ], 64 | "no-empty": false, 65 | "no-inferrable-types": [ 66 | true, 67 | "ignore-params" 68 | ], 69 | "no-non-null-assertion": true, 70 | "no-redundant-jsdoc": true, 71 | "no-string-literal": false, 72 | "no-switch-case-fall-through": true, 73 | "no-use-before-declare": true, 74 | "no-var-requires": false, 75 | "object-literal-key-quotes": [ 76 | true, 77 | "as-needed" 78 | ], 79 | "object-literal-sort-keys": false, 80 | "object-literal-shorthand": false, 81 | "ordered-imports": false, 82 | "quotemark": [ 83 | true, 84 | "single" 85 | ], 86 | "trailing-comma": false, 87 | "no-conflicting-lifecycle": true, 88 | "no-host-metadata-property": true, 89 | "no-input-rename": true, 90 | "no-inputs-metadata-property": true, 91 | "no-output-native": true, 92 | "no-output-on-prefix": true, 93 | "no-output-rename": true, 94 | "no-outputs-metadata-property": true, 95 | "template-banana-in-box": true, 96 | "template-no-negated-async": true, 97 | "use-lifecycle-interface": true, 98 | "use-pipe-transform-interface": true, 99 | "variable-name": { 100 | "options": [ 101 | "ban-keywords", 102 | "check-format", 103 | "allow-pascal-case", 104 | "allow-leading-underscore" 105 | ] 106 | } 107 | }, 108 | "rulesDirectory": [ 109 | "codelyzer" 110 | ] 111 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Deborah Kurata 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 | # Angular-HigherOrderMapping 2 | Demonstrates higher order mapping operators 3 | --------------------------------------------------------------------------------