mirror of
https://github.com/Dansen999/at-certification-stock.git
synced 2026-01-11 05:24:27 +00:00
Pushed new version.
This commit is contained in:
16
.browserslistrc
Normal file
16
.browserslistrc
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||||
|
# For additional information regarding the format and rule options, please see:
|
||||||
|
# https://github.com/browserslist/browserslist#queries
|
||||||
|
|
||||||
|
# For the full list of supported browsers by the Angular framework, please see:
|
||||||
|
# https://angular.io/guide/browser-support
|
||||||
|
|
||||||
|
# You can see what browsers were selected by your queries by running:
|
||||||
|
# npx browserslist
|
||||||
|
|
||||||
|
last 1 Chrome version
|
||||||
|
last 1 Firefox version
|
||||||
|
last 2 Edge major versions
|
||||||
|
last 2 Safari major versions
|
||||||
|
last 2 iOS major versions
|
||||||
|
Firefox ESR
|
||||||
16
.editorconfig
Normal file
16
.editorconfig
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Editor configuration, see https://editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.ts]
|
||||||
|
quote_type = single
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
max_line_length = off
|
||||||
|
trim_trailing_whitespace = false
|
||||||
42
.gitignore
vendored
Normal file
42
.gitignore
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# Compiled output
|
||||||
|
/dist
|
||||||
|
/tmp
|
||||||
|
/out-tsc
|
||||||
|
/bazel-out
|
||||||
|
nng
|
||||||
|
# Node
|
||||||
|
/node_modules
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
|
||||||
|
# IDEs and editors
|
||||||
|
.idea/
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.c9/
|
||||||
|
*.launch
|
||||||
|
.settings/
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.history/*
|
||||||
|
|
||||||
|
# Miscellaneous
|
||||||
|
/.angular/cache
|
||||||
|
.sass-cache/
|
||||||
|
/connect.lock
|
||||||
|
/coverage
|
||||||
|
/libpeerconnection.log
|
||||||
|
testem.log
|
||||||
|
/typings
|
||||||
|
|
||||||
|
# System files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
4
.vscode/extensions.json
vendored
Normal file
4
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
|
||||||
|
"recommendations": ["angular.ng-template"]
|
||||||
|
}
|
||||||
20
.vscode/launch.json
vendored
Normal file
20
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "ng serve",
|
||||||
|
"type": "pwa-chrome",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "npm: start",
|
||||||
|
"url": "http://localhost:4200/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ng test",
|
||||||
|
"type": "chrome",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "npm: test",
|
||||||
|
"url": "http://localhost:9876/debug.html"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
42
.vscode/tasks.json
vendored
Normal file
42
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "start",
|
||||||
|
"isBackground": true,
|
||||||
|
"problemMatcher": {
|
||||||
|
"owner": "typescript",
|
||||||
|
"pattern": "$tsc",
|
||||||
|
"background": {
|
||||||
|
"activeOnStart": true,
|
||||||
|
"beginsPattern": {
|
||||||
|
"regexp": "(.*?)"
|
||||||
|
},
|
||||||
|
"endsPattern": {
|
||||||
|
"regexp": "bundle generation complete"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "test",
|
||||||
|
"isBackground": true,
|
||||||
|
"problemMatcher": {
|
||||||
|
"owner": "typescript",
|
||||||
|
"pattern": "$tsc",
|
||||||
|
"background": {
|
||||||
|
"activeOnStart": true,
|
||||||
|
"beginsPattern": {
|
||||||
|
"regexp": "(.*?)"
|
||||||
|
},
|
||||||
|
"endsPattern": {
|
||||||
|
"regexp": "bundle generation complete"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
28
README.md
28
README.md
@@ -1,3 +1,27 @@
|
|||||||
# at-certification-stock
|
# AtCertificationStock
|
||||||
|
|
||||||
[Edit on StackBlitz ⚡️](https://stackblitz.com/edit/angular-ivy-2c4mp6)
|
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.2.8.
|
||||||
|
|
||||||
|
## Development server
|
||||||
|
|
||||||
|
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
|
||||||
|
|
||||||
|
## Code scaffolding
|
||||||
|
|
||||||
|
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`.
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||||
|
|
||||||
|
## Running unit tests
|
||||||
|
|
||||||
|
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||||
|
|
||||||
|
## Running end-to-end tests
|
||||||
|
|
||||||
|
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
|
||||||
|
|
||||||
|
## Further help
|
||||||
|
|
||||||
|
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
||||||
|
|||||||
85
angular.json
85
angular.json
@@ -3,65 +3,80 @@
|
|||||||
"version": 1,
|
"version": 1,
|
||||||
"newProjectRoot": "projects",
|
"newProjectRoot": "projects",
|
||||||
"projects": {
|
"projects": {
|
||||||
"demo": {
|
"at-certification-stock": {
|
||||||
|
"projectType": "application",
|
||||||
|
"schematics": {},
|
||||||
"root": "",
|
"root": "",
|
||||||
"sourceRoot": "src",
|
"sourceRoot": "src",
|
||||||
"projectType": "application",
|
|
||||||
"prefix": "app",
|
"prefix": "app",
|
||||||
"schematics": {},
|
|
||||||
"architect": {
|
"architect": {
|
||||||
"build": {
|
"build": {
|
||||||
"builder": "@angular-devkit/build-angular:browser",
|
"builder": "@angular-devkit/build-angular:browser",
|
||||||
"options": {
|
"options": {
|
||||||
"outputPath": "dist/demo",
|
"outputPath": "dist/at-certification-stock",
|
||||||
"index": "src/index.html",
|
"index": "src/index.html",
|
||||||
"main": "src/main.ts",
|
"main": "src/main.ts",
|
||||||
"polyfills": "src/polyfills.ts",
|
"polyfills": "src/polyfills.ts",
|
||||||
"tsConfig": "src/tsconfig.app.json",
|
"tsConfig": "tsconfig.app.json",
|
||||||
"assets": [
|
"assets": [
|
||||||
"src/favicon.ico",
|
"src/favicon.ico",
|
||||||
"src/assets"
|
"src/assets"
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
|
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
|
||||||
"src/styles.css"
|
"src/styles.css"
|
||||||
],
|
],
|
||||||
"scripts": []
|
"scripts": []
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"type": "initial",
|
||||||
|
"maximumWarning": "500kb",
|
||||||
|
"maximumError": "1mb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
"maximumWarning": "2kb",
|
||||||
|
"maximumError": "4kb"
|
||||||
|
}
|
||||||
|
],
|
||||||
"fileReplacements": [
|
"fileReplacements": [
|
||||||
{
|
{
|
||||||
"replace": "src/environments/environment.ts",
|
"replace": "src/environments/environment.ts",
|
||||||
"with": "src/environments/environment.prod.ts"
|
"with": "src/environments/environment.prod.ts"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"optimization": true,
|
"outputHashing": "all"
|
||||||
"outputHashing": "all",
|
},
|
||||||
"sourceMap": false,
|
"development": {
|
||||||
"extractCss": true,
|
"buildOptimizer": false,
|
||||||
"namedChunks": false,
|
"optimization": false,
|
||||||
"aot": true,
|
"vendorChunk": true,
|
||||||
"extractLicenses": true,
|
"extractLicenses": false,
|
||||||
"vendorChunk": false,
|
"sourceMap": true,
|
||||||
"buildOptimizer": true
|
"namedChunks": true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"defaultConfiguration": "production"
|
||||||
},
|
},
|
||||||
"serve": {
|
"serve": {
|
||||||
"builder": "@angular-devkit/build-angular:dev-server",
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
"options": {
|
|
||||||
"browserTarget": "demo:build"
|
|
||||||
},
|
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
"browserTarget": "demo:build:production"
|
"browserTarget": "at-certification-stock:build:production"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"browserTarget": "at-certification-stock:build:development"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"defaultConfiguration": "development"
|
||||||
},
|
},
|
||||||
"extract-i18n": {
|
"extract-i18n": {
|
||||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||||
"options": {
|
"options": {
|
||||||
"browserTarget": "demo:build"
|
"browserTarget": "at-certification-stock:build"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"test": {
|
"test": {
|
||||||
@@ -69,32 +84,20 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"main": "src/test.ts",
|
"main": "src/test.ts",
|
||||||
"polyfills": "src/polyfills.ts",
|
"polyfills": "src/polyfills.ts",
|
||||||
"tsConfig": "src/tsconfig.spec.json",
|
"tsConfig": "tsconfig.spec.json",
|
||||||
"karmaConfig": "src/karma.conf.js",
|
"karmaConfig": "karma.conf.js",
|
||||||
"styles": [
|
|
||||||
"styles.css"
|
|
||||||
],
|
|
||||||
"scripts": [],
|
|
||||||
"assets": [
|
"assets": [
|
||||||
"src/favicon.ico",
|
"src/favicon.ico",
|
||||||
"src/assets"
|
"src/assets"
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lint": {
|
|
||||||
"builder": "@angular-devkit/build-angular:tslint",
|
|
||||||
"options": {
|
|
||||||
"tsConfig": [
|
|
||||||
"src/tsconfig.app.json",
|
|
||||||
"src/tsconfig.spec.json"
|
|
||||||
],
|
],
|
||||||
"exclude": [
|
"styles": [
|
||||||
"**/node_modules/**"
|
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
|
||||||
]
|
"src/styles.css"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"defaultProject": "demo"
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
44
karma.conf.js
Normal file
44
karma.conf.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
// Karma configuration file, see link for more information
|
||||||
|
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||||
|
|
||||||
|
module.exports = function (config) {
|
||||||
|
config.set({
|
||||||
|
basePath: '',
|
||||||
|
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||||
|
plugins: [
|
||||||
|
require('karma-jasmine'),
|
||||||
|
require('karma-chrome-launcher'),
|
||||||
|
require('karma-jasmine-html-reporter'),
|
||||||
|
require('karma-coverage'),
|
||||||
|
require('@angular-devkit/build-angular/plugins/karma')
|
||||||
|
],
|
||||||
|
client: {
|
||||||
|
jasmine: {
|
||||||
|
// you can add configuration options for Jasmine here
|
||||||
|
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
||||||
|
// for example, you can disable the random execution with `random: false`
|
||||||
|
// or set a specific seed with `seed: 4321`
|
||||||
|
},
|
||||||
|
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||||
|
},
|
||||||
|
jasmineHtmlReporter: {
|
||||||
|
suppressAll: true // removes the duplicated traces
|
||||||
|
},
|
||||||
|
coverageReporter: {
|
||||||
|
dir: require('path').join(__dirname, './coverage/at-certification-stock'),
|
||||||
|
subdir: '.',
|
||||||
|
reporters: [
|
||||||
|
{ type: 'html' },
|
||||||
|
{ type: 'text-summary' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
reporters: ['progress', 'kjhtml'],
|
||||||
|
port: 9876,
|
||||||
|
colors: true,
|
||||||
|
logLevel: config.LOG_INFO,
|
||||||
|
autoWatch: true,
|
||||||
|
browsers: ['Chrome'],
|
||||||
|
singleRun: false,
|
||||||
|
restartOnFileChange: true
|
||||||
|
});
|
||||||
|
};
|
||||||
41
package.json
41
package.json
@@ -1,39 +1,40 @@
|
|||||||
{
|
{
|
||||||
"name": "angular",
|
"name": "at-certification-stock",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"build": "ng build",
|
"build": "ng build",
|
||||||
"test": "ng test",
|
"watch": "ng build --watch --configuration development",
|
||||||
"lint": "ng lint",
|
"test": "ng test"
|
||||||
"e2e": "ng e2e"
|
|
||||||
},
|
},
|
||||||
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^14.0.0",
|
"@angular/animations": "^14.2.0",
|
||||||
"@angular/common": "^14.0.0",
|
"@angular/cdk": "^14.2.6",
|
||||||
"@angular/compiler": "^14.0.0",
|
"@angular/common": "^14.2.0",
|
||||||
"@angular/core": "^14.0.0",
|
"@angular/compiler": "^14.2.0",
|
||||||
"@angular/forms": "^14.0.0",
|
"@angular/core": "^14.2.0",
|
||||||
"@angular/platform-browser": "^14.0.0",
|
"@angular/forms": "^14.2.0",
|
||||||
"@angular/platform-browser-dynamic": "^14.0.0",
|
"@angular/material": "^14.2.6",
|
||||||
"@angular/router": "^14.0.0",
|
"@angular/platform-browser": "^14.2.0",
|
||||||
|
"@angular/platform-browser-dynamic": "^14.2.0",
|
||||||
|
"@angular/router": "^14.2.0",
|
||||||
"rxjs": "~7.5.0",
|
"rxjs": "~7.5.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
"zone.js": "~0.11.4"
|
"zone.js": "~0.11.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "^14.0.0",
|
"@angular-devkit/build-angular": "^14.2.8",
|
||||||
"@angular/cli": "~14.0.0",
|
"@angular/cli": "~14.2.8",
|
||||||
"@angular/compiler-cli": "^14.0.0",
|
"@angular/compiler-cli": "^14.2.0",
|
||||||
"@types/jasmine": "~4.0.0",
|
"@types/jasmine": "~4.0.0",
|
||||||
"jasmine-core": "~4.1.0",
|
"jasmine-core": "~4.3.0",
|
||||||
"karma": "~6.3.0",
|
"karma": "~6.4.0",
|
||||||
"karma-chrome-launcher": "~3.1.0",
|
"karma-chrome-launcher": "~3.1.0",
|
||||||
"karma-coverage": "~2.2.0",
|
"karma-coverage": "~2.2.0",
|
||||||
"karma-jasmine": "~5.0.0",
|
"karma-jasmine": "~5.1.0",
|
||||||
"karma-jasmine-html-reporter": "~1.7.0",
|
"karma-jasmine-html-reporter": "~2.0.0",
|
||||||
"typescript": "~4.7.2"
|
"typescript": "~4.7.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
src/app/app-routing.module.ts
Normal file
17
src/app/app-routing.module.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import {NgModule} from '@angular/core';
|
||||||
|
import {RouterModule, Routes} from '@angular/router';
|
||||||
|
import {SentimentComponent} from "./pages/sentiment/sentiment.component";
|
||||||
|
import {LandingPageComponent} from "./pages/landing-page/landing-page.component";
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
|
||||||
|
{path: 'sentiment/:symbol', component: SentimentComponent},
|
||||||
|
{path: '**', component: LandingPageComponent}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forRoot(routes)],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
export class AppRoutingModule {
|
||||||
|
}
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
p {
|
|
||||||
font-family: Lato;
|
|
||||||
}
|
|
||||||
@@ -1,4 +1 @@
|
|||||||
<hello name="{{ name }}"></hello>
|
<router-outlet></router-outlet>
|
||||||
<p>
|
|
||||||
Start editing to see some magic happen :)
|
|
||||||
</p>
|
|
||||||
|
|||||||
35
src/app/app.component.spec.ts
Normal file
35
src/app/app.component.spec.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
|
describe('AppComponent', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
RouterTestingModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
AppComponent
|
||||||
|
],
|
||||||
|
}).compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create the app', () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
const app = fixture.componentInstance;
|
||||||
|
expect(app).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should have as title 'at-certification-stock'`, () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
const app = fixture.componentInstance;
|
||||||
|
expect(app.title).toEqual('at-certification-stock');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should render title', () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
fixture.detectChanges();
|
||||||
|
const compiled = fixture.nativeElement as HTMLElement;
|
||||||
|
expect(compiled.querySelector('.content span')?.textContent).toContain('at-certification-stock app is running!');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import { Component, VERSION } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-app',
|
selector: 'app-root',
|
||||||
templateUrl: './app.component.html',
|
templateUrl: './app.component.html',
|
||||||
styleUrls: [ './app.component.css' ]
|
styleUrls: ['./app.component.css']
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
name = 'Angular ' + VERSION.major;
|
title = 'at-certification-stock';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,48 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import {BrowserModule} from '@angular/platform-browser';
|
||||||
import { FormsModule } from '@angular/forms';
|
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
import {AppRoutingModule} from './app-routing.module';
|
||||||
import { HelloComponent } from './hello.component';
|
import {AppComponent} from './app.component';
|
||||||
|
import {HttpClientModule} from "@angular/common/http";
|
||||||
|
import {SentimentComponent} from './pages/sentiment/sentiment.component';
|
||||||
|
import {LandingPageComponent} from './pages/landing-page/landing-page.component';
|
||||||
|
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||||
|
import {MatCardModule} from "@angular/material/card";
|
||||||
|
import {MatFormFieldModule} from "@angular/material/form-field";
|
||||||
|
import {MatButtonModule} from "@angular/material/button";
|
||||||
|
import {MatInputModule} from "@angular/material/input";
|
||||||
|
import {MatDividerModule} from "@angular/material/divider";
|
||||||
|
import {FormsModule} from "@angular/forms";
|
||||||
|
import {MatProgressSpinnerModule} from "@angular/material/progress-spinner";
|
||||||
|
import {MatSnackBarModule} from "@angular/material/snack-bar";
|
||||||
|
import {MatGridListModule} from "@angular/material/grid-list";
|
||||||
|
import { StockCardComponent } from './components/stock-card/stock-card.component';
|
||||||
|
import {MatIconModule} from "@angular/material/icon";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [ BrowserModule, FormsModule ],
|
declarations: [
|
||||||
declarations: [ AppComponent, HelloComponent ],
|
AppComponent,
|
||||||
bootstrap: [ AppComponent ]
|
SentimentComponent,
|
||||||
|
LandingPageComponent,
|
||||||
|
StockCardComponent
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
FormsModule,
|
||||||
|
BrowserModule,
|
||||||
|
AppRoutingModule,
|
||||||
|
HttpClientModule,
|
||||||
|
BrowserAnimationsModule,
|
||||||
|
MatCardModule,
|
||||||
|
MatFormFieldModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatDividerModule,
|
||||||
|
MatSnackBarModule,
|
||||||
|
MatGridListModule,
|
||||||
|
MatIconModule
|
||||||
|
],
|
||||||
|
providers: [],
|
||||||
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
export class AppModule { }
|
export class AppModule {
|
||||||
|
}
|
||||||
|
|||||||
16
src/app/components/stock-card/stock-card.component.css
Normal file
16
src/app/components/stock-card/stock-card.component.css
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
.mat-card {
|
||||||
|
margin: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-card-title .mat-icon {
|
||||||
|
cursor: pointer;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-grid-tile .mat-icon {
|
||||||
|
font-size: 4rem;
|
||||||
|
height: 4rem;
|
||||||
|
width: 4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
27
src/app/components/stock-card/stock-card.component.html
Normal file
27
src/app/components/stock-card/stock-card.component.html
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<mat-card>
|
||||||
|
<mat-card-title>{{company.description}} ({{company.symbol}})
|
||||||
|
<mat-icon (click)="remove()" fontIcon="close"></mat-icon>
|
||||||
|
</mat-card-title>
|
||||||
|
<mat-card-content>
|
||||||
|
<ng-container *ngIf="getQuote() | async; let quote">
|
||||||
|
<mat-grid-list cols="4" rowHeight="4:1">
|
||||||
|
|
||||||
|
<mat-grid-tile colspan="2"></mat-grid-tile>
|
||||||
|
<mat-grid-tile colspan="2" rowspan="3">
|
||||||
|
<mat-icon *ngIf="quote.dp>0" color="primary" fontIcon="arrow_upward"></mat-icon>
|
||||||
|
<mat-icon *ngIf="quote.dp<0" color="warn" fontIcon="arrow_downward"></mat-icon>
|
||||||
|
<mat-icon *ngIf="quote.dp==0" fontIcon="east"></mat-icon>
|
||||||
|
</mat-grid-tile>
|
||||||
|
|
||||||
|
<mat-grid-tile><p>Change today: {{quote.dp / 100 | percent: '1.1-1'}}</p></mat-grid-tile>
|
||||||
|
<mat-grid-tile><p>Opening price: {{quote.o | currency: 'USD'}}</p></mat-grid-tile>
|
||||||
|
<mat-grid-tile><p>Current price: {{quote.c | currency: 'USD'}}</p></mat-grid-tile>
|
||||||
|
<mat-grid-tile><p>High price: {{quote.h | currency: 'USD'}}</p></mat-grid-tile>
|
||||||
|
</mat-grid-list>
|
||||||
|
</ng-container>
|
||||||
|
</mat-card-content>
|
||||||
|
|
||||||
|
<mat-card-actions align="end">
|
||||||
|
<button mat-button [routerLink]="'/sentiment/' + company.symbol">Go to social sentiment details</button>
|
||||||
|
</mat-card-actions>
|
||||||
|
</mat-card>
|
||||||
23
src/app/components/stock-card/stock-card.component.spec.ts
Normal file
23
src/app/components/stock-card/stock-card.component.spec.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { StockCardComponent } from './stock-card.component';
|
||||||
|
|
||||||
|
describe('StockCardComponent', () => {
|
||||||
|
let component: StockCardComponent;
|
||||||
|
let fixture: ComponentFixture<StockCardComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ StockCardComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(StockCardComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
40
src/app/components/stock-card/stock-card.component.ts
Normal file
40
src/app/components/stock-card/stock-card.component.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
|
||||||
|
import {FinnhubService} from "../../services/finnhub.service";
|
||||||
|
import {Company, QuoteResponse} from "../../model/company-data";
|
||||||
|
import {Subject, Subscription} from "rxjs";
|
||||||
|
import {StorageService} from "../../services/storage.service";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-stock-card',
|
||||||
|
templateUrl: './stock-card.component.html',
|
||||||
|
styleUrls: ['./stock-card.component.css']
|
||||||
|
})
|
||||||
|
export class StockCardComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
company = {} as Company;
|
||||||
|
|
||||||
|
private _quote$ = new Subject<QuoteResponse>();
|
||||||
|
private subs: Subscription[] = [];
|
||||||
|
|
||||||
|
constructor(public finnhubService: FinnhubService,
|
||||||
|
public storageService: StorageService) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.subs.push(this.finnhubService.getQuote(this.company.symbol).subscribe(value => this._quote$.next(value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
getQuote(): Subject<QuoteResponse> {
|
||||||
|
return this._quote$;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
this.subs.forEach(s => s.unsubscribe());
|
||||||
|
this._quote$.complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
remove() {
|
||||||
|
this.storageService.remove(this.company.symbol);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'hello',
|
|
||||||
template: `<h1>Hello {{name}}!</h1>`,
|
|
||||||
styles: [`h1 { font-family: Lato; }`]
|
|
||||||
})
|
|
||||||
export class HelloComponent {
|
|
||||||
@Input() name: string;
|
|
||||||
}
|
|
||||||
21
src/app/model/company-data.ts
Normal file
21
src/app/model/company-data.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
export interface Company {
|
||||||
|
description: string;
|
||||||
|
displaySymbol: string;
|
||||||
|
symbol: string;
|
||||||
|
type: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SearchResponse {
|
||||||
|
count: number;
|
||||||
|
result: Array<Company>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QuoteResponse {
|
||||||
|
c: number;
|
||||||
|
d: number;
|
||||||
|
dp: number;
|
||||||
|
h: number;
|
||||||
|
l: number;
|
||||||
|
o: number;
|
||||||
|
pc: number;
|
||||||
|
}
|
||||||
7
src/app/pages/landing-page/landing-page.component.css
Normal file
7
src/app/pages/landing-page/landing-page.component.css
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
.mat-card {
|
||||||
|
margin: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-divider {
|
||||||
|
margin: 0 1rem;
|
||||||
|
}
|
||||||
26
src/app/pages/landing-page/landing-page.component.html
Normal file
26
src/app/pages/landing-page/landing-page.component.html
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<mat-card>
|
||||||
|
<mat-card-content>
|
||||||
|
<p>
|
||||||
|
Enter the symbol of a stock to track (i.e. AAPL, TSLA, GOOGL)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<input id="stockInput"
|
||||||
|
matInput
|
||||||
|
[(ngModel)]="symbol"/>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<button id="trackBtn"
|
||||||
|
mat-stroked-button
|
||||||
|
color="primary"
|
||||||
|
[disabled]="disabled"
|
||||||
|
(click)="addSymbol()">Track Stock
|
||||||
|
</button>
|
||||||
|
</mat-card-content>
|
||||||
|
</mat-card>
|
||||||
|
|
||||||
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
|
<ng-container *ngFor="let company of storageService.get() | async ">
|
||||||
|
<app-stock-card [company]="company"></app-stock-card>
|
||||||
|
</ng-container>
|
||||||
23
src/app/pages/landing-page/landing-page.component.spec.ts
Normal file
23
src/app/pages/landing-page/landing-page.component.spec.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { LandingPageComponent } from './landing-page.component';
|
||||||
|
|
||||||
|
describe('LandingPageComponent', () => {
|
||||||
|
let component: LandingPageComponent;
|
||||||
|
let fixture: ComponentFixture<LandingPageComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ LandingPageComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(LandingPageComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
52
src/app/pages/landing-page/landing-page.component.ts
Normal file
52
src/app/pages/landing-page/landing-page.component.ts
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
import {FinnhubService} from "../../services/finnhub.service";
|
||||||
|
import {StorageService} from "../../services/storage.service";
|
||||||
|
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-landing-page',
|
||||||
|
templateUrl: './landing-page.component.html',
|
||||||
|
styleUrls: ['./landing-page.component.css']
|
||||||
|
})
|
||||||
|
export class LandingPageComponent implements OnInit {
|
||||||
|
|
||||||
|
symbol = '';
|
||||||
|
disabled = false;
|
||||||
|
|
||||||
|
constructor(public finnhubService: FinnhubService,
|
||||||
|
public storageService: StorageService,
|
||||||
|
private snackBar: MatSnackBar) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
addSymbol() {
|
||||||
|
console.log('search for ' + this.symbol)
|
||||||
|
|
||||||
|
// start loading...
|
||||||
|
this.disabled = true;
|
||||||
|
this.finnhubService.searchSymbol(this.symbol).subscribe(value => {
|
||||||
|
|
||||||
|
if (value.count > 0) {
|
||||||
|
|
||||||
|
let company = value.result.find(company => company.symbol == this.symbol);
|
||||||
|
if (company) {
|
||||||
|
this.storageService.add(company);
|
||||||
|
this.symbol = '';
|
||||||
|
} else {
|
||||||
|
this.snackBar.open('No unique result', 'close', {duration: 10000});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.disabled = false
|
||||||
|
} else {
|
||||||
|
this.snackBar.open('No result', 'close', {duration: 10000});
|
||||||
|
this.disabled = false
|
||||||
|
}
|
||||||
|
}, (error) => {
|
||||||
|
this.snackBar.open('Communication error', 'close', {duration: 10000});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
0
src/app/pages/sentiment/sentiment.component.css
Normal file
0
src/app/pages/sentiment/sentiment.component.css
Normal file
1
src/app/pages/sentiment/sentiment.component.html
Normal file
1
src/app/pages/sentiment/sentiment.component.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<p>sentiment works!</p>
|
||||||
23
src/app/pages/sentiment/sentiment.component.spec.ts
Normal file
23
src/app/pages/sentiment/sentiment.component.spec.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { SentimentComponent } from './sentiment.component';
|
||||||
|
|
||||||
|
describe('SentimentComponent', () => {
|
||||||
|
let component: SentimentComponent;
|
||||||
|
let fixture: ComponentFixture<SentimentComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ SentimentComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(SentimentComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
16
src/app/pages/sentiment/sentiment.component.ts
Normal file
16
src/app/pages/sentiment/sentiment.component.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import {FinnhubService} from "../../services/finnhub.service";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-sentiment',
|
||||||
|
templateUrl: './sentiment.component.html',
|
||||||
|
styleUrls: ['./sentiment.component.css']
|
||||||
|
})
|
||||||
|
export class SentimentComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor(private finnhubService: FinnhubService) { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
16
src/app/services/finnhub.service.spec.ts
Normal file
16
src/app/services/finnhub.service.spec.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { FinnhubService } from './finnhub.service';
|
||||||
|
|
||||||
|
describe('FinnhubService', () => {
|
||||||
|
let service: FinnhubService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(FinnhubService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
29
src/app/services/finnhub.service.ts
Normal file
29
src/app/services/finnhub.service.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import {HttpClient} from "@angular/common/http";
|
||||||
|
import {Observable} from "rxjs";
|
||||||
|
import {QuoteResponse, SearchResponse} from "../model/company-data";
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class FinnhubService {
|
||||||
|
|
||||||
|
private readonly token = { 'token': 'bu4f8kn48v6uehqi3cqg' };
|
||||||
|
private readonly api = 'https://finnhub.io/api/v1';
|
||||||
|
private readonly apiQuote = this.api + '/quote';
|
||||||
|
private readonly apiSearch = this.api + '/search';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private httpClient: HttpClient) { }
|
||||||
|
|
||||||
|
searchSymbol(q: string): Observable<SearchResponse> {
|
||||||
|
return this.httpClient.get<SearchResponse>(this.apiSearch, {params: { ...this.token, q }});
|
||||||
|
}
|
||||||
|
|
||||||
|
getQuote(symbol: string) {
|
||||||
|
return this.httpClient.get<QuoteResponse>(this.apiQuote, {params: { ...this.token, symbol }});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
16
src/app/services/storage.service.spec.ts
Normal file
16
src/app/services/storage.service.spec.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { StorageService } from './storage.service';
|
||||||
|
|
||||||
|
describe('StorageService', () => {
|
||||||
|
let service: StorageService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(StorageService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
41
src/app/services/storage.service.ts
Normal file
41
src/app/services/storage.service.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import {Injectable, OnDestroy} from '@angular/core';
|
||||||
|
import {BehaviorSubject} from "rxjs";
|
||||||
|
import {Company} from "../model/company-data";
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class StorageService implements OnDestroy {
|
||||||
|
|
||||||
|
private storage: Company[] = [];
|
||||||
|
|
||||||
|
private _storage$ = new BehaviorSubject<Company[]>([]);
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
add(company: Company): void {
|
||||||
|
this.storage.push(company);
|
||||||
|
this._storage$.next(this.storage)
|
||||||
|
}
|
||||||
|
|
||||||
|
remove(symbol: string): void {
|
||||||
|
console.log('Remove ' + symbol)
|
||||||
|
|
||||||
|
let index = this.storage.findIndex(company => company.symbol == symbol);
|
||||||
|
if (index > -1) {
|
||||||
|
this.storage.splice(index, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(this.storage)
|
||||||
|
this._storage$.next(this.storage)
|
||||||
|
}
|
||||||
|
|
||||||
|
get(): BehaviorSubject<Company[]> {
|
||||||
|
return this._storage$;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
this._storage$.complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
0
src/assets/.gitkeep
Normal file
0
src/assets/.gitkeep
Normal file
3
src/environments/environment.prod.ts
Normal file
3
src/environments/environment.prod.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export const environment = {
|
||||||
|
production: true
|
||||||
|
};
|
||||||
16
src/environments/environment.ts
Normal file
16
src/environments/environment.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// This file can be replaced during build by using the `fileReplacements` array.
|
||||||
|
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
|
||||||
|
// The list of file replacements can be found in `angular.json`.
|
||||||
|
|
||||||
|
export const environment = {
|
||||||
|
production: false
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For easier debugging in development mode, you can import the following file
|
||||||
|
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
||||||
|
*
|
||||||
|
* This import should be commented out in production mode because it will have a negative impact
|
||||||
|
* on performance if an error is thrown.
|
||||||
|
*/
|
||||||
|
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
|
||||||
BIN
src/favicon.ico
Normal file
BIN
src/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 948 B |
@@ -1 +1,16 @@
|
|||||||
<my-app>loading</my-app>
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>AtCertificationStock</title>
|
||||||
|
<base href="/">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body class="mat-typography">
|
||||||
|
<app-root></app-root>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
16
src/main.ts
16
src/main.ts
@@ -1,16 +1,12 @@
|
|||||||
import './polyfills';
|
|
||||||
|
|
||||||
import { enableProdMode } from '@angular/core';
|
import { enableProdMode } from '@angular/core';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import { AppModule } from './app/app.module';
|
import { AppModule } from './app/app.module';
|
||||||
|
import { environment } from './environments/environment';
|
||||||
|
|
||||||
platformBrowserDynamic().bootstrapModule(AppModule).then(ref => {
|
if (environment.production) {
|
||||||
// Ensure Angular destroys itself on hot reloads.
|
enableProdMode();
|
||||||
if (window['ngRef']) {
|
}
|
||||||
window['ngRef'].destroy();
|
|
||||||
}
|
|
||||||
window['ngRef'] = ref;
|
|
||||||
|
|
||||||
// Otherwise, log the boot error
|
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||||
}).catch(err => console.error(err));
|
.catch(err => console.error(err));
|
||||||
|
|||||||
@@ -8,64 +8,46 @@
|
|||||||
* file.
|
* file.
|
||||||
*
|
*
|
||||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||||
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
* automatically update themselves. This includes recent versions of Safari, Chrome (including
|
||||||
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
|
||||||
*
|
*
|
||||||
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
* Learn more in https://angular.io/guide/browser-support
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/***************************************************************************************************
|
/***************************************************************************************************
|
||||||
* BROWSER POLYFILLS
|
* BROWSER POLYFILLS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
|
|
||||||
// import 'core-js/es6/symbol';
|
|
||||||
// import 'core-js/es6/object';
|
|
||||||
// import 'core-js/es6/function';
|
|
||||||
// import 'core-js/es6/parse-int';
|
|
||||||
// import 'core-js/es6/parse-float';
|
|
||||||
// import 'core-js/es6/number';
|
|
||||||
// import 'core-js/es6/math';
|
|
||||||
// import 'core-js/es6/string';
|
|
||||||
// import 'core-js/es6/date';
|
|
||||||
// import 'core-js/es6/array';
|
|
||||||
// import 'core-js/es6/regexp';
|
|
||||||
// import 'core-js/es6/map';
|
|
||||||
// import 'core-js/es6/set';
|
|
||||||
|
|
||||||
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
|
||||||
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
|
||||||
|
|
||||||
/** IE10 and IE11 requires the following to support `@angular/animation`. */
|
|
||||||
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
|
||||||
|
|
||||||
|
|
||||||
/** Evergreen browsers require these. **/
|
|
||||||
// import 'core-js/es6/reflect';
|
|
||||||
// import 'core-js/es7/reflect';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Web Animations `@angular/platform-browser/animations`
|
* By default, zone.js will patch all possible macroTask and DomEvents
|
||||||
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
|
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||||
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
|
* because those flags need to be set before `zone.js` being loaded, and webpack
|
||||||
|
* will put import in the top of bundle, so user need to create a separate file
|
||||||
|
* in this directory (for example: zone-flags.ts), and put the following flags
|
||||||
|
* into that file, and then add the following code before importing zone.js.
|
||||||
|
* import './zone-flags';
|
||||||
|
*
|
||||||
|
* The flags allowed in zone-flags.ts are listed here.
|
||||||
|
*
|
||||||
|
* The following flags will work for all browsers.
|
||||||
|
*
|
||||||
|
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||||
|
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||||
|
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||||
|
*
|
||||||
|
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||||
|
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||||
|
*
|
||||||
|
* (window as any).__Zone_enable_cross_context_check = true;
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************************
|
/***************************************************************************************************
|
||||||
* Zone JS is required by Angular itself.
|
* Zone JS is required by default for Angular itself.
|
||||||
*/
|
*/
|
||||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
import 'zone.js'; // Included with Angular CLI.
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************************
|
/***************************************************************************************************
|
||||||
* APPLICATION IMPORTS
|
* APPLICATION IMPORTS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Date, currency, decimal and percent pipes.
|
|
||||||
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
|
|
||||||
*/
|
|
||||||
// import 'intl'; // Run `npm install --save intl`.
|
|
||||||
@@ -1 +1,4 @@
|
|||||||
/* Add application styles & imports to this file! */
|
/* You can add global styles to this file, and also import other style files */
|
||||||
|
|
||||||
|
html, body { height: 100%; }
|
||||||
|
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
|
||||||
|
|||||||
26
src/test.ts
Normal file
26
src/test.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||||
|
|
||||||
|
import 'zone.js/testing';
|
||||||
|
import { getTestBed } from '@angular/core/testing';
|
||||||
|
import {
|
||||||
|
BrowserDynamicTestingModule,
|
||||||
|
platformBrowserDynamicTesting
|
||||||
|
} from '@angular/platform-browser-dynamic/testing';
|
||||||
|
|
||||||
|
declare const require: {
|
||||||
|
context(path: string, deep?: boolean, filter?: RegExp): {
|
||||||
|
<T>(id: string): T;
|
||||||
|
keys(): string[];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// First, initialize the Angular testing environment.
|
||||||
|
getTestBed().initTestEnvironment(
|
||||||
|
BrowserDynamicTestingModule,
|
||||||
|
platformBrowserDynamicTesting(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Then we find all the tests.
|
||||||
|
const context = require.context('./', true, /\.spec\.ts$/);
|
||||||
|
// And load the modules.
|
||||||
|
context.keys().forEach(context);
|
||||||
15
tsconfig.app.json
Normal file
15
tsconfig.app.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./out-tsc/app",
|
||||||
|
"types": []
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/main.ts",
|
||||||
|
"src/polyfills.ts"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"src/**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,27 +1,32 @@
|
|||||||
|
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||||
{
|
{
|
||||||
"compileOnSave": false,
|
"compileOnSave": false,
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": "./",
|
"baseUrl": "./",
|
||||||
"outDir": "./dist/out-tsc",
|
"outDir": "./dist/out-tsc",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"strict": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"declaration": false,
|
"declaration": false,
|
||||||
"downlevelIteration": true,
|
"downlevelIteration": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"module": "esnext",
|
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
"target": "es2015",
|
"target": "es2020",
|
||||||
"typeRoots": [
|
"module": "es2020",
|
||||||
"node_modules/@types"
|
|
||||||
],
|
|
||||||
"lib": [
|
"lib": [
|
||||||
"es2018",
|
"es2020",
|
||||||
"dom"
|
"dom"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
"enableIvy": true,
|
"enableI18nLegacyMessageIdFormat": false,
|
||||||
"fullTemplateTypeCheck": true,
|
"strictInjectionParameters": true,
|
||||||
"strictInjectionParameters": true
|
"strictInputAccessModifiers": true,
|
||||||
|
"strictTemplates": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
18
tsconfig.spec.json
Normal file
18
tsconfig.spec.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./out-tsc/spec",
|
||||||
|
"types": [
|
||||||
|
"jasmine"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/test.ts",
|
||||||
|
"src/polyfills.ts"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
"src/**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user