├── .editorconfig.json
├── .gitignore
├── README.md
├── angular.json
├── e2e
├── src
│ ├── app.e2e-spec.ts
│ └── app.po.ts
└── tsconfig.e2e.json
├── package.json
├── screenshots
├── addOrder.png
├── selectOrder.png
└── table.png
├── src
├── app
│ ├── app.component.css
│ ├── app.component.html
│ ├── app.component.spec.ts
│ ├── app.component.ts
│ ├── app.module.ts
│ ├── domain
│ │ └── order.ts
│ └── services
│ │ └── orderservice.ts
├── browserslist
├── environments
│ ├── environment.prod.ts
│ └── environment.ts
├── favicon.ico
├── index.html
├── karma.conf.js
├── main.ts
├── market
│ └── orderbook
│ │ └── order-book.json
├── polyfills.ts
├── styles.css
├── test.ts
├── tsconfig.app.json
├── tsconfig.spec.json
└── tslint.json
├── tsconfig.json
└── tslint.json
/.editorconfig.json:
--------------------------------------------------------------------------------
1 | # Editor configuration, see http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 4
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | max_line_length = off
13 | trim_trailing_whitespace = false
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 |
7 | # dependencies
8 | /node_modules
9 |
10 | # IDEs and editors
11 | /.idea
12 | .project
13 | .classpath
14 | .c9/
15 | *.launch
16 | .settings/
17 | *.sublime-workspace
18 |
19 | # IDE - VSCode
20 | .vscode/*
21 | !.vscode/settings.json
22 | !.vscode/tasks.json
23 | !.vscode/launch.json
24 | !.vscode/extensions.json
25 |
26 | # misc
27 | /.sass-cache
28 | /connect.lock
29 | /coverage/*
30 | /libpeerconnection.log
31 | npm-debug.log
32 | testem.log
33 | /typings
34 |
35 | # e2e
36 | /e2e/*.js
37 | /e2e/*.map
38 |
39 | #System Files
40 | .DS_Store
41 | Thumbs.db
42 | package-lock.json
43 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Angular OrderBook App
2 |
3 | An order book is the list of orders that a trading venue uses to record the interest of buyers and sellers in a particular financial instrument. An
4 | order will be one of either a buy or sell order and contain a price and a volume.
5 |
6 | ## Usecases:
7 |
8 | **Step1:** Format the orderbook into a table showing the list of bids and list of offers.
9 | 
10 |
11 | **Step2:** Add new order which updates the orderbook
12 | 
13 |
14 | **Step3:** Display order details when you select particular order
15 | 
16 |
17 | ## Assumptions:
18 | 1. Let's reformat the data structure as per dataGrid
19 | 2. Mock the data in order-book.json file instead endpoint **/market/orderbook** Since the backend is not available
20 |
21 | ## Development server
22 | 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.
23 |
24 | ## Running unit tests
25 |
26 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
27 |
28 | ## Running end-to-end tests
29 |
30 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
31 | Before running the tests make sure you are serving the app via `ng serve`.
32 |
33 |
--------------------------------------------------------------------------------
/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "angular-orderbook-app": {
7 | "root": "",
8 | "sourceRoot": "src",
9 | "projectType": "application",
10 | "prefix": "app",
11 | "schematics": {},
12 | "architect": {
13 | "build": {
14 | "builder": "@angular-devkit/build-angular:browser",
15 | "options": {
16 | "outputPath": "dist/angular-orderbook-app",
17 | "index": "src/index.html",
18 | "main": "src/main.ts",
19 | "polyfills": "src/polyfills.ts",
20 | "tsConfig": "src/tsconfig.app.json",
21 | "assets": [
22 | "src/favicon.ico",
23 | "src/market"
24 | ],
25 | "styles": [
26 | "node_modules/primeng/resources/themes/omega/theme.css",
27 | "node_modules/primeng/resources/primeng.min.css",
28 | "node_modules/primeicons/primeicons.css",
29 | "src/styles.css"
30 | ],
31 | "scripts": []
32 | },
33 | "configurations": {
34 | "production": {
35 | "fileReplacements": [
36 | {
37 | "replace": "src/environments/environment.ts",
38 | "with": "src/environments/environment.prod.ts"
39 | }
40 | ],
41 | "optimization": true,
42 | "outputHashing": "all",
43 | "sourceMap": false,
44 | "extractCss": true,
45 | "namedChunks": false,
46 | "aot": true,
47 | "extractLicenses": true,
48 | "vendorChunk": false,
49 | "buildOptimizer": true
50 | }
51 | }
52 | },
53 | "serve": {
54 | "builder": "@angular-devkit/build-angular:dev-server",
55 | "options": {
56 | "browserTarget": "angular-orderbook-app:build"
57 | },
58 | "configurations": {
59 | "production": {
60 | "browserTarget": "angular-orderbook-app:build:production"
61 | }
62 | }
63 | },
64 | "extract-i18n": {
65 | "builder": "@angular-devkit/build-angular:extract-i18n",
66 | "options": {
67 | "browserTarget": "angular-orderbook-app:build"
68 | }
69 | },
70 | "test": {
71 | "builder": "@angular-devkit/build-angular:karma",
72 | "options": {
73 | "main": "src/test.ts",
74 | "polyfills": "src/polyfills.ts",
75 | "tsConfig": "src/tsconfig.spec.json",
76 | "karmaConfig": "src/karma.conf.js",
77 | "styles": [
78 | "src/styles.css"
79 | ],
80 | "scripts": [],
81 | "assets": [
82 | "src/favicon.ico",
83 | "src/market"
84 | ]
85 | }
86 | },
87 | "lint": {
88 | "builder": "@angular-devkit/build-angular:tslint",
89 | "options": {
90 | "tsConfig": [
91 | "src/tsconfig.app.json",
92 | "src/tsconfig.spec.json"
93 | ],
94 | "exclude": [
95 | "**/node_modules/**"
96 | ]
97 | }
98 | }
99 | }
100 | },
101 | "angular-orderbook-app-e2e": {
102 | "root": "e2e/",
103 | "projectType": "application",
104 | "architect": {
105 | "e2e": {
106 | "builder": "@angular-devkit/build-angular:protractor",
107 | "options": {
108 | "protractorConfig": "e2e/protractor.conf.js",
109 | "devServerTarget": "angular-orderbook-app:serve"
110 | }
111 | },
112 | "lint": {
113 | "builder": "@angular-devkit/build-angular:tslint",
114 | "options": {
115 | "tsConfig": "e2e/tsconfig.e2e.json",
116 | "exclude": [
117 | "**/node_modules/**"
118 | ]
119 | }
120 | }
121 | }
122 | }
123 | },
124 | "defaultProject": "angular-orderbook-app"
125 | }
--------------------------------------------------------------------------------
/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 |
3 | describe('angular-orderbook-app App', () => {
4 | let page: AppPage;
5 |
6 | beforeEach(() => {
7 | page = new AppPage();
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, element, by } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo() {
5 | return browser.get('/');
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/e2e/tsconfig.e2e.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Angular-OrderBook-App",
3 | "version": "1.0.0",
4 | "author": "Sudheer Jonna",
5 | "license": "MIT",
6 | "scripts": {
7 | "ng": "ng",
8 | "start": "ng serve",
9 | "build": "ng build",
10 | "test": "ng test",
11 | "lint": "ng lint",
12 | "e2e": "ng e2e"
13 | },
14 | "repository": {
15 | "type": "git",
16 | "url": "https://github.com/sudheerj/angular-orderbook-app.git"
17 | },
18 | "dependencies": {
19 | "@angular/animations": "6.0.4",
20 | "@angular/common": "6.0.4",
21 | "@angular/compiler": "6.0.4",
22 | "@angular/core": "6.0.4",
23 | "@angular/forms": "6.0.4",
24 | "@angular/http": "6.0.4",
25 | "@angular/platform-browser": "6.0.4",
26 | "@angular/platform-browser-dynamic": "6.0.4",
27 | "@angular/router": "6.0.4",
28 | "core-js": "2.5.7",
29 | "rxjs": "6.2.0",
30 | "zone.js": "0.8.26",
31 | "primeicons": "1.0.0-beta.9",
32 | "primeng": "6.0.0",
33 | "web-animations-js": "2.3.1"
34 | },
35 | "devDependencies": {
36 | "@angular/compiler-cli": "6.0.4",
37 | "@angular-devkit/build-angular": "0.6.8",
38 | "typescript": "2.7.2",
39 | "@angular/cli": "6.0.8",
40 | "@angular/language-service": "6.0.4",
41 | "@types/jasmine": "2.8.8",
42 | "@types/jasminewd2": "2.0.3",
43 | "@types/node": "8.9.5",
44 | "codelyzer": "4.2.1",
45 | "jasmine-core": "2.99.1",
46 | "jasmine-spec-reporter": "4.2.1",
47 | "karma": "1.7.1",
48 | "karma-chrome-launcher": "2.2.0",
49 | "karma-coverage-istanbul-reporter": "2.0.1",
50 | "karma-jasmine": "1.1.2",
51 | "karma-jasmine-html-reporter": "0.2.2",
52 | "protractor": "5.3.2",
53 | "ts-node": "5.0.1",
54 | "tslint": "5.9.1"
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/screenshots/addOrder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sudheerj/angular-orderbook-app/64fdbbbd4f749ecc93adbb560caecfaf25119e9c/screenshots/addOrder.png
--------------------------------------------------------------------------------
/screenshots/selectOrder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sudheerj/angular-orderbook-app/64fdbbbd4f749ecc93adbb560caecfaf25119e9c/screenshots/selectOrder.png
--------------------------------------------------------------------------------
/screenshots/table.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sudheerj/angular-orderbook-app/64fdbbbd4f749ecc93adbb560caecfaf25119e9c/screenshots/table.png
--------------------------------------------------------------------------------
/src/app/app.component.css:
--------------------------------------------------------------------------------
1 | .buyStyle {
2 | color: #0000FF !important;
3 | }
4 |
5 | .sellStyle {
6 | color: #008000 !important;
7 | }
8 |
9 | .redStyle {
10 | color: red !important;
11 | }
12 |
13 | #layout-topbar {
14 | background-color: #f4f4f4;
15 | box-sizing: border-box;
16 | display: block;
17 | padding: 0;
18 | height: 70px;
19 | box-sizing: border-box;
20 | position: fixed;
21 | top: 0;
22 | left: 0;
23 | width: 100%;
24 | z-index: 9997;
25 | box-shadow: 0 2px 5px 0 rgba(0,0,0,.3);
26 | font-weight: bold;
27 | text-align: center;
28 | }
29 |
30 | .dataGridStyle {
31 | padding-top: 70px;
32 | }
33 |
34 | .titleStyle {
35 | margin-top: 30px;
36 | }
--------------------------------------------------------------------------------
/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | An Order Book Application
4 |
5 |
6 |
7 |
8 | An Order Book
9 |
10 |
11 |
12 | Buy Orders |
13 | Sell Orders |
14 |
15 |
16 |
17 | {{col.header}}
18 | |
19 |
20 |
21 |
22 |
23 | rowData.sellPrice ? 'redStyle' : 'sellStyle')">
24 | {{rowData[col.field]}}
25 | |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
56 |
57 |
58 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 | import { FormsModule } from '@angular/forms';
3 | import { HttpClientTestingModule } from '@angular/common/http/testing';
4 |
5 | import { AppComponent } from './app.component';
6 | import { TableModule } from 'primeng/table';
7 | import { DialogModule } from 'primeng/dialog';
8 | import {RadioButtonModule} from 'primeng/radiobutton';
9 | import {MessageModule} from 'primeng/message';
10 |
11 | describe('AppComponent', () => {
12 | beforeEach(async(() => {
13 | TestBed.configureTestingModule({
14 | imports: [
15 | FormsModule,
16 | HttpClientTestingModule,
17 | TableModule,
18 | DialogModule,
19 | RadioButtonModule,
20 | MessageModule
21 | ],
22 | declarations: [
23 | AppComponent
24 | ],
25 | }).compileComponents();
26 | }));
27 |
28 | it('should create the app', async(() => {
29 | const fixture = TestBed.createComponent(AppComponent);
30 | const app = fixture.debugElement.componentInstance;
31 | expect(app).toBeTruthy();
32 | }));
33 | });
34 |
--------------------------------------------------------------------------------
/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { Order } from './domain/order';
3 | import { OrderService } from './services/orderservice';
4 |
5 | export class OrderBook implements Order {
6 | constructor(public buyQty?, public buyPrice?, public sellQty?, public sellPrice?) {}
7 | }
8 |
9 | @Component({
10 | selector: 'app-root',
11 | templateUrl: './app.component.html',
12 | styleUrls: ['./app.component.css'],
13 | providers: [OrderService]
14 | })
15 | export class AppComponent implements OnInit {
16 |
17 | displayDialog: boolean;
18 |
19 | displayDetailsDialog: boolean;
20 |
21 | order: Order = new OrderBook();
22 |
23 | selectedOrder: Order;
24 |
25 | newOrder: boolean;
26 |
27 | orders: Order[];
28 |
29 | cols: any[];
30 |
31 | orderType: string = 'buy';
32 |
33 | constructor(private orderService: OrderService) { }
34 |
35 | ngOnInit() {
36 | this.orderService.getOrderBook().then(orders => this.orders = orders);
37 |
38 | this.cols = [
39 | { field: 'buyQty', header: 'Buy Qty' },
40 | { field: 'buyPrice', header: 'Buy Price' },
41 | { field: 'sellQty', header: 'Sell Qty' },
42 | { field: 'sellPrice', header: 'Sell Price' }
43 | ];
44 |
45 | }
46 |
47 | showDialogToAdd() {
48 | this.newOrder = true;
49 | this.order = new OrderBook();
50 | this.displayDialog = true;
51 | }
52 |
53 | save() {
54 | const orders = [...this.orders];
55 | if (this.newOrder) {
56 | orders.push(this.order);
57 | } else {
58 | orders[this.findSelectedOrderIndex()] = this.order;
59 | }
60 | this.orders = orders;
61 | this.order = null;
62 | this.displayDialog = false;
63 | this.displayDetailsDialog = false;
64 | }
65 |
66 | onRowSelect(event) {
67 | this.newOrder = false;
68 | this.order = {...event.data};
69 | this.displayDetailsDialog = true;
70 | }
71 |
72 | findSelectedOrderIndex(): number {
73 | return this.orders.indexOf(this.selectedOrder);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import {CommonModule} from '@angular/common';
3 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
4 | import { NgModule } from '@angular/core';
5 | import { FormsModule,ReactiveFormsModule } from '@angular/forms';
6 | import { HttpClientModule } from '@angular/common/http';
7 | import { InputTextModule } from 'primeng/inputtext';
8 | import { ButtonModule } from 'primeng/button';
9 | import { TableModule } from 'primeng/table';
10 | import { DialogModule } from 'primeng/dialog';
11 | import {RadioButtonModule} from 'primeng/radiobutton';
12 | import {MessageModule} from 'primeng/message';
13 |
14 | import { AppComponent } from './app.component';
15 |
16 | @NgModule({
17 | declarations: [
18 | AppComponent
19 | ],
20 | imports: [
21 | BrowserModule,
22 | CommonModule,
23 | BrowserAnimationsModule,
24 | FormsModule,
25 | ReactiveFormsModule,
26 | TableModule,
27 | HttpClientModule,
28 | InputTextModule,
29 | DialogModule,
30 | ButtonModule,
31 | RadioButtonModule,
32 | MessageModule
33 | ],
34 | providers: [],
35 | bootstrap: [AppComponent]
36 | })
37 | export class AppModule { }
38 |
--------------------------------------------------------------------------------
/src/app/domain/order.ts:
--------------------------------------------------------------------------------
1 | export interface Order {
2 | buyQty?;
3 | buyPrice?;
4 | sellQty?;
5 | sellPrice?;
6 | }
7 |
--------------------------------------------------------------------------------
/src/app/services/orderservice.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { HttpClient } from '@angular/common/http';
3 | import { Order } from '../domain/order';
4 |
5 | @Injectable()
6 | export class OrderService {
7 |
8 | constructor(private http: HttpClient) {}
9 |
10 | getOrderBook() {
11 | return this.http.get('market/orderbook/order-book.json')
12 | .toPromise()
13 | .then(response => response.data)
14 | .then(data => data);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/browserslist:
--------------------------------------------------------------------------------
1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 | # For IE 9-11 support, please uncomment the last line of the file and adjust as needed
5 | > 0.5%
6 | last 2 versions
7 | Firefox ESR
8 | not dead
9 | # IE 9-11
--------------------------------------------------------------------------------
/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // The file contents for the current environment will overwrite these during build.
2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do
3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead.
4 | // The list of which env maps to which file can be found in `.angular-cli.json`.
5 |
6 | export const environment = {
7 | production: false
8 | };
9 |
--------------------------------------------------------------------------------
/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sudheerj/angular-orderbook-app/64fdbbbd4f749ecc93adbb560caecfaf25119e9c/src/favicon.ico
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | An order book
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../coverage'),
20 | reports: ['html', 'lcovonly'],
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 | });
31 | };
32 |
--------------------------------------------------------------------------------
/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.log(err));
13 |
--------------------------------------------------------------------------------
/src/market/orderbook/order-book.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": [
3 | {"buyQty": 400, "buyPrice": 20.00, "sellQty": 23.90, "sellPrice": 50},
4 | {"buyQty": 850, "buyPrice": 12.00, "sellQty": 24, "sellPrice": 1000},
5 | {"buyQty": 25, "buyPrice": 10.00, "sellQty": 24.45, "sellPrice": 1000},
6 | {"buyQty": 750, "buyPrice": 6.00, "sellQty": 24.90, "sellPrice": 925},
7 | {"buyQty": 500, "buyPrice": 5.10, "sellQty": 25.90, "sellPrice": 3950}
8 | ]
9 | }
10 |
--------------------------------------------------------------------------------
/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/docs/ts/latest/guide/browser-support.html
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/
22 | import 'core-js/es6/symbol';
23 | import 'core-js/es6/object';
24 | import 'core-js/es6/function';
25 | import 'core-js/es6/parse-int';
26 | import 'core-js/es6/parse-float';
27 | import 'core-js/es6/number';
28 | import 'core-js/es6/math';
29 | import 'core-js/es6/string';
30 | import 'core-js/es6/date';
31 | import 'core-js/es6/array';
32 | import 'core-js/es6/regexp';
33 | import 'core-js/es6/map';
34 | import 'core-js/es6/weak-map';
35 | import 'core-js/es6/set';
36 |
37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
38 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
39 |
40 | /** IE10 and IE11 requires the following for the Reflect API. */
41 | import 'core-js/es6/reflect';
42 |
43 |
44 | /** Evergreen browsers require these. **/
45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
46 | import 'core-js/es7/reflect';
47 |
48 | /**
49 | * Web Animations `@angular/platform-browser/animations`
50 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
51 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
52 | **/
53 | import 'web-animations-js'; // Run `npm install --save web-animations-js`.
54 |
55 | /**
56 | * By default, zone.js will patch all possible macroTask and DomEvents
57 | * user can disable parts of macroTask/DomEvents patch by setting following flags
58 | */
59 |
60 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
61 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
62 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
63 |
64 | /*
65 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
66 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
67 | */
68 | // (window as any).__Zone_enable_cross_context_check = true;
69 |
70 | /***************************************************************************************************
71 | * Zone JS is required by default for Angular itself.
72 | */
73 | import 'zone.js/dist/zone'; // Included with Angular CLI.
74 |
75 |
76 |
77 | /***************************************************************************************************
78 | * APPLICATION IMPORTS
79 | */
80 |
--------------------------------------------------------------------------------
/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: any;
11 |
12 | // First, initialize the Angular testing environment.
13 | getTestBed().initTestEnvironment(
14 | BrowserDynamicTestingModule,
15 | platformBrowserDynamicTesting()
16 | );
17 | // Then we find all the tests.
18 | const context = require.context('./', true, /\.spec\.ts$/);
19 | // And load the modules.
20 | context.keys().map(context);
21 |
--------------------------------------------------------------------------------
/src/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "module": "es2015",
6 | "types": []
7 | },
8 | "exclude": [
9 | "test.ts",
10 | "**/*.spec.ts"
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------
/src/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/spec",
5 | "module": "commonjs",
6 | "types": [
7 | "jasmine",
8 | "node"
9 | ]
10 | },
11 | "files": [
12 | "test.ts",
13 | "polyfills.ts"
14 | ],
15 | "include": [
16 | "**/*.spec.ts",
17 | "**/*.d.ts"
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/src/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "outDir": "./dist/out-tsc",
6 | "sourceMap": true,
7 | "declaration": false,
8 | "moduleResolution": "node",
9 | "emitDecoratorMetadata": true,
10 | "experimentalDecorators": true,
11 | "target": "es5",
12 | "typeRoots": [
13 | "node_modules/@types"
14 | ],
15 | "lib": [
16 | "es2017",
17 | "dom"
18 | ]
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rulesDirectory": [
3 | "node_modules/codelyzer"
4 | ],
5 | "rules": {
6 | "arrow-return-shorthand": true,
7 | "callable-types": true,
8 | "class-name": true,
9 | "comment-format": [
10 | true,
11 | "check-space"
12 | ],
13 | "curly": true,
14 | "deprecation": {
15 | "severity": "warn"
16 | },
17 | "eofline": true,
18 | "forin": true,
19 | "import-blacklist": [
20 | true,
21 | "rxjs/Rx"
22 | ],
23 | "import-spacing": true,
24 | "indent": [
25 | true,
26 | "spaces"
27 | ],
28 | "interface-over-type-literal": true,
29 | "label-position": true,
30 | "max-line-length": [
31 | true,
32 | 140
33 | ],
34 | "member-access": false,
35 | "member-ordering": [
36 | true,
37 | {
38 | "order": [
39 | "static-field",
40 | "instance-field",
41 | "static-method",
42 | "instance-method"
43 | ]
44 | }
45 | ],
46 | "no-arg": true,
47 | "no-bitwise": true,
48 | "no-console": [
49 | true,
50 | "debug",
51 | "info",
52 | "time",
53 | "timeEnd",
54 | "trace"
55 | ],
56 | "no-construct": true,
57 | "no-debugger": true,
58 | "no-duplicate-super": true,
59 | "no-empty": false,
60 | "no-empty-interface": true,
61 | "no-eval": true,
62 | "no-inferrable-types": [
63 | true,
64 | "ignore-params"
65 | ],
66 | "no-misused-new": true,
67 | "no-non-null-assertion": true,
68 | "no-shadowed-variable": true,
69 | "no-string-literal": false,
70 | "no-string-throw": true,
71 | "no-switch-case-fall-through": true,
72 | "no-trailing-whitespace": true,
73 | "no-unnecessary-initializer": true,
74 | "no-unused-expression": true,
75 | "no-use-before-declare": true,
76 | "no-var-keyword": true,
77 | "object-literal-sort-keys": false,
78 | "one-line": [
79 | true,
80 | "check-open-brace",
81 | "check-catch",
82 | "check-else",
83 | "check-whitespace"
84 | ],
85 | "prefer-const": true,
86 | "quotemark": [
87 | true,
88 | "single"
89 | ],
90 | "radix": true,
91 | "semicolon": [
92 | true,
93 | "always"
94 | ],
95 | "triple-equals": [
96 | true,
97 | "allow-null-check"
98 | ],
99 | "typedef-whitespace": [
100 | true,
101 | {
102 | "call-signature": "nospace",
103 | "index-signature": "nospace",
104 | "parameter": "nospace",
105 | "property-declaration": "nospace",
106 | "variable-declaration": "nospace"
107 | }
108 | ],
109 | "unified-signatures": true,
110 | "variable-name": false,
111 | "whitespace": [
112 | true,
113 | "check-branch",
114 | "check-decl",
115 | "check-operator",
116 | "check-separator",
117 | "check-type"
118 | ],
119 | "no-output-on-prefix": true,
120 | "use-input-property-decorator": true,
121 | "use-output-property-decorator": true,
122 | "use-host-property-decorator": true,
123 | "no-input-rename": true,
124 | "no-output-rename": true,
125 | "use-life-cycle-interface": true,
126 | "use-pipe-transform-interface": true,
127 | "component-class-suffix": true,
128 | "directive-class-suffix": true
129 | }
130 | }
131 |
--------------------------------------------------------------------------------