├── .editorconfig
├── .gitignore
├── README.md
├── angular.json
├── e2e
├── protractor.conf.js
├── src
│ ├── app.e2e-spec.ts
│ └── app.po.ts
└── tsconfig.e2e.json
├── package-lock.json
├── package.json
├── src
├── app
│ ├── add-item-form
│ │ ├── add-item-form.component.html
│ │ ├── add-item-form.component.scss
│ │ ├── add-item-form.component.spec.ts
│ │ └── add-item-form.component.ts
│ ├── app-routing.module.ts
│ ├── app.component.html
│ ├── app.component.scss
│ ├── app.component.spec.ts
│ ├── app.component.ts
│ ├── app.module.ts
│ ├── budget-item-list
│ │ ├── budget-item-card
│ │ │ ├── budget-item-card.component.html
│ │ │ ├── budget-item-card.component.scss
│ │ │ ├── budget-item-card.component.spec.ts
│ │ │ └── budget-item-card.component.ts
│ │ ├── budget-item-list.component.html
│ │ ├── budget-item-list.component.scss
│ │ ├── budget-item-list.component.spec.ts
│ │ └── budget-item-list.component.ts
│ ├── edit-item-modal
│ │ ├── edit-item-modal.component.html
│ │ ├── edit-item-modal.component.scss
│ │ ├── edit-item-modal.component.spec.ts
│ │ └── edit-item-modal.component.ts
│ └── main-page
│ │ ├── main-page.component.html
│ │ ├── main-page.component.scss
│ │ ├── main-page.component.spec.ts
│ │ └── main-page.component.ts
├── assets
│ ├── .gitkeep
│ ├── delete_icon.svg
│ ├── screenshots
│ │ ├── 01_Budget_App_Screenshot.png
│ │ ├── 02_Budget_App_Screenshot.png
│ │ ├── 03_Budget_App_Screenshot.png
│ │ ├── 04_Budget_App_Screenshot.png
│ │ └── 05_Budget_App_Screenshot.png
│ └── thumbnail.png
├── browserslist
├── environments
│ ├── environment.prod.ts
│ └── environment.ts
├── favicon.ico
├── index.html
├── karma.conf.js
├── main-styles.scss
├── main.ts
├── polyfills.ts
├── shared
│ └── models
│ │ └── budget-item.model.ts
├── styles.scss
├── test.ts
├── tsconfig.app.json
├── tsconfig.spec.json
└── tslint.json
├── tsconfig.json
└── tslint.json
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see https://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | max_line_length = off
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 |
8 | # dependencies
9 | /node_modules
10 |
11 | # profiling files
12 | chrome-profiler-events.json
13 | speed-measure-plugin.json
14 |
15 | # IDEs and editors
16 | /.idea
17 | .project
18 | .classpath
19 | .c9/
20 | *.launch
21 | .settings/
22 | *.sublime-workspace
23 |
24 | # IDE - VSCode
25 | .vscode/*
26 | !.vscode/settings.json
27 | !.vscode/tasks.json
28 | !.vscode/launch.json
29 | !.vscode/extensions.json
30 | .history/*
31 |
32 | # misc
33 | /.sass-cache
34 | /connect.lock
35 | /coverage
36 | /libpeerconnection.log
37 | npm-debug.log
38 | yarn-error.log
39 | testem.log
40 | /typings
41 |
42 | # System Files
43 | .DS_Store
44 | Thumbs.db
45 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Budget Calculator App (Angular)
2 |
3 | [](https://youtu.be/sU4z4Ti-8OQ)
4 |
5 | ##### Watch the full tutorial on [Youtube](https://youtu.be/sU4z4Ti-8OQ)!
6 |
7 | ## Screenshots
8 |
9 | [](https://youtu.be/sU4z4Ti-8OQ)
10 |
11 | [](https://youtu.be/sU4z4Ti-8OQ)
12 |
13 | [](https://youtu.be/sU4z4Ti-8OQ)
14 |
15 | [](https://youtu.be/sU4z4Ti-8OQ)
16 |
17 | [](https://youtu.be/sU4z4Ti-8OQ)
18 |
19 | ---
20 |
21 | ## Development server
22 |
23 | 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.
24 |
25 | ## Code scaffolding
26 |
27 | 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`.
28 |
29 | ## Build
30 |
31 | 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.
32 |
33 | ## Running unit tests
34 |
35 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
36 |
37 | ## Running end-to-end tests
38 |
39 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
40 |
41 | ## Further help
42 |
43 | 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).
44 |
--------------------------------------------------------------------------------
/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "budget-app": {
7 | "root": "",
8 | "sourceRoot": "src",
9 | "projectType": "application",
10 | "prefix": "app",
11 | "schematics": {
12 | "@schematics/angular:component": {
13 | "styleext": "scss"
14 | }
15 | },
16 | "architect": {
17 | "build": {
18 | "builder": "@angular-devkit/build-angular:browser",
19 | "options": {
20 | "outputPath": "dist/budget-app",
21 | "index": "src/index.html",
22 | "main": "src/main.ts",
23 | "polyfills": "src/polyfills.ts",
24 | "tsConfig": "src/tsconfig.app.json",
25 | "assets": [
26 | "src/favicon.ico",
27 | "src/assets"
28 | ],
29 | "styles": [
30 | "src/styles.scss"
31 | ],
32 | "scripts": []
33 | },
34 | "configurations": {
35 | "production": {
36 | "fileReplacements": [
37 | {
38 | "replace": "src/environments/environment.ts",
39 | "with": "src/environments/environment.prod.ts"
40 | }
41 | ],
42 | "optimization": true,
43 | "outputHashing": "all",
44 | "sourceMap": false,
45 | "extractCss": true,
46 | "namedChunks": false,
47 | "aot": true,
48 | "extractLicenses": true,
49 | "vendorChunk": false,
50 | "buildOptimizer": true,
51 | "budgets": [
52 | {
53 | "type": "initial",
54 | "maximumWarning": "2mb",
55 | "maximumError": "5mb"
56 | }
57 | ]
58 | }
59 | }
60 | },
61 | "serve": {
62 | "builder": "@angular-devkit/build-angular:dev-server",
63 | "options": {
64 | "browserTarget": "budget-app:build"
65 | },
66 | "configurations": {
67 | "production": {
68 | "browserTarget": "budget-app:build:production"
69 | }
70 | }
71 | },
72 | "extract-i18n": {
73 | "builder": "@angular-devkit/build-angular:extract-i18n",
74 | "options": {
75 | "browserTarget": "budget-app:build"
76 | }
77 | },
78 | "test": {
79 | "builder": "@angular-devkit/build-angular:karma",
80 | "options": {
81 | "main": "src/test.ts",
82 | "polyfills": "src/polyfills.ts",
83 | "tsConfig": "src/tsconfig.spec.json",
84 | "karmaConfig": "src/karma.conf.js",
85 | "styles": [
86 | "src/styles.scss"
87 | ],
88 | "scripts": [],
89 | "assets": [
90 | "src/favicon.ico",
91 | "src/assets"
92 | ]
93 | }
94 | },
95 | "lint": {
96 | "builder": "@angular-devkit/build-angular:tslint",
97 | "options": {
98 | "tsConfig": [
99 | "src/tsconfig.app.json",
100 | "src/tsconfig.spec.json"
101 | ],
102 | "exclude": [
103 | "**/node_modules/**"
104 | ]
105 | }
106 | }
107 | }
108 | },
109 | "budget-app-e2e": {
110 | "root": "e2e/",
111 | "projectType": "application",
112 | "prefix": "",
113 | "architect": {
114 | "e2e": {
115 | "builder": "@angular-devkit/build-angular:protractor",
116 | "options": {
117 | "protractorConfig": "e2e/protractor.conf.js",
118 | "devServerTarget": "budget-app:serve"
119 | },
120 | "configurations": {
121 | "production": {
122 | "devServerTarget": "budget-app:serve:production"
123 | }
124 | }
125 | },
126 | "lint": {
127 | "builder": "@angular-devkit/build-angular:tslint",
128 | "options": {
129 | "tsConfig": "e2e/tsconfig.e2e.json",
130 | "exclude": [
131 | "**/node_modules/**"
132 | ]
133 | }
134 | }
135 | }
136 | }
137 | },
138 | "defaultProject": "budget-app"
139 | }
--------------------------------------------------------------------------------
/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // Protractor configuration file, see link for more information
2 | // https://github.com/angular/protractor/blob/master/lib/config.ts
3 |
4 | const { SpecReporter } = require('jasmine-spec-reporter');
5 |
6 | exports.config = {
7 | allScriptsTimeout: 11000,
8 | specs: [
9 | './src/**/*.e2e-spec.ts'
10 | ],
11 | capabilities: {
12 | 'browserName': 'chrome'
13 | },
14 | directConnect: true,
15 | baseUrl: 'http://localhost:4200/',
16 | framework: 'jasmine',
17 | jasmineNodeOpts: {
18 | showColors: true,
19 | defaultTimeoutInterval: 30000,
20 | print: function() {}
21 | },
22 | onPrepare() {
23 | require('ts-node').register({
24 | project: require('path').join(__dirname, './tsconfig.e2e.json')
25 | });
26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
27 | }
28 | };
--------------------------------------------------------------------------------
/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 |
3 | describe('workspace-project App', () => {
4 | let page: AppPage;
5 |
6 | beforeEach(() => {
7 | page = new AppPage();
8 | });
9 |
10 | it('should display welcome message', () => {
11 | page.navigateTo();
12 | expect(page.getTitleText()).toEqual('Welcome to budget-app!');
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo() {
5 | return browser.get('/');
6 | }
7 |
8 | getTitleText() {
9 | return element(by.css('app-root h1')).getText();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/e2e/tsconfig.e2e.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "budget-app",
3 | "version": "0.0.0",
4 | "scripts": {
5 | "ng": "ng",
6 | "start": "ng serve",
7 | "build": "ng build",
8 | "test": "ng test",
9 | "lint": "ng lint",
10 | "e2e": "ng e2e"
11 | },
12 | "private": true,
13 | "dependencies": {
14 | "@angular/animations": "^7.2.12",
15 | "@angular/cdk": "^7.3.7",
16 | "@angular/common": "~7.2.0",
17 | "@angular/compiler": "~7.2.0",
18 | "@angular/core": "~7.2.0",
19 | "@angular/forms": "~7.2.0",
20 | "@angular/material": "^7.3.7",
21 | "@angular/platform-browser": "~7.2.0",
22 | "@angular/platform-browser-dynamic": "~7.2.0",
23 | "@angular/router": "~7.2.0",
24 | "bulma": "^0.7.4",
25 | "core-js": "^2.5.4",
26 | "rxjs": "~6.3.3",
27 | "tslib": "^1.9.0",
28 | "zone.js": "~0.8.26"
29 | },
30 | "devDependencies": {
31 | "@angular-devkit/build-angular": "~0.12.0",
32 | "@angular/cli": "~7.2.1",
33 | "@angular/compiler-cli": "~7.2.0",
34 | "@angular/language-service": "~7.2.0",
35 | "@types/node": "~8.9.4",
36 | "@types/jasmine": "~2.8.8",
37 | "@types/jasminewd2": "~2.0.3",
38 | "codelyzer": "~4.5.0",
39 | "jasmine-core": "~2.99.1",
40 | "jasmine-spec-reporter": "~4.2.1",
41 | "karma": "~3.1.1",
42 | "karma-chrome-launcher": "~2.2.0",
43 | "karma-coverage-istanbul-reporter": "~2.0.1",
44 | "karma-jasmine": "~1.1.2",
45 | "karma-jasmine-html-reporter": "^0.2.2",
46 | "protractor": "~5.4.0",
47 | "ts-node": "~7.0.0",
48 | "tslint": "~5.11.0",
49 | "typescript": "~3.2.2"
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/app/add-item-form/add-item-form.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/add-item-form/add-item-form.component.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devstackr/budget-app-angular/a0f0c89133421043c14b180c38a9bc3b0ba53a4c/src/app/add-item-form/add-item-form.component.scss
--------------------------------------------------------------------------------
/src/app/add-item-form/add-item-form.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { AddItemFormComponent } from './add-item-form.component';
4 |
5 | describe('AddItemFormComponent', () => {
6 | let component: AddItemFormComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ AddItemFormComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(AddItemFormComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/add-item-form/add-item-form.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
2 | import { NgForm } from '@angular/forms';
3 | import { BudgetItem } from 'src/shared/models/budget-item.model';
4 |
5 |
6 | @Component({
7 | selector: 'app-add-item-form',
8 | templateUrl: './add-item-form.component.html',
9 | styleUrls: ['./add-item-form.component.scss']
10 | })
11 | export class AddItemFormComponent implements OnInit {
12 |
13 | @Input() item: BudgetItem;
14 | @Output() formSubmit: EventEmitter = new EventEmitter();
15 |
16 | isNewItem: boolean;
17 |
18 | constructor() { }
19 |
20 | ngOnInit() {
21 | // if item has a value
22 | if (this.item) {
23 | // this means that an existing item object was passed into this component
24 | // therefore this is not a new item
25 | this.isNewItem = false;
26 | } else {
27 | this.isNewItem = true;
28 | this.item = new BudgetItem('', null);
29 | }
30 | }
31 |
32 | onSubmit(form: NgForm) {
33 | this.formSubmit.emit(form.value);
34 | form.reset();
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/app/app-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import { MainPageComponent } from './main-page/main-page.component';
4 |
5 | const routes: Routes = [
6 | { path: '', component: MainPageComponent }
7 | ];
8 |
9 | @NgModule({
10 | imports: [RouterModule.forRoot(routes)],
11 | exports: [RouterModule]
12 | })
13 | export class AppRoutingModule { }
14 |
--------------------------------------------------------------------------------
/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/app/app.component.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devstackr/budget-app-angular/a0f0c89133421043c14b180c38a9bc3b0ba53a4c/src/app/app.component.scss
--------------------------------------------------------------------------------
/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 | import { RouterTestingModule } from '@angular/router/testing';
3 | import { AppComponent } from './app.component';
4 |
5 | describe('AppComponent', () => {
6 | beforeEach(async(() => {
7 | TestBed.configureTestingModule({
8 | imports: [
9 | RouterTestingModule
10 | ],
11 | declarations: [
12 | AppComponent
13 | ],
14 | }).compileComponents();
15 | }));
16 |
17 | it('should create the app', () => {
18 | const fixture = TestBed.createComponent(AppComponent);
19 | const app = fixture.debugElement.componentInstance;
20 | expect(app).toBeTruthy();
21 | });
22 |
23 | it(`should have as title 'budget-app'`, () => {
24 | const fixture = TestBed.createComponent(AppComponent);
25 | const app = fixture.debugElement.componentInstance;
26 | expect(app.title).toEqual('budget-app');
27 | });
28 |
29 | it('should render title in a h1 tag', () => {
30 | const fixture = TestBed.createComponent(AppComponent);
31 | fixture.detectChanges();
32 | const compiled = fixture.debugElement.nativeElement;
33 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to budget-app!');
34 | });
35 | });
36 |
--------------------------------------------------------------------------------
/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-root',
5 | templateUrl: './app.component.html',
6 | styleUrls: ['./app.component.scss']
7 | })
8 | export class AppComponent {
9 | title = 'budget-app';
10 | }
11 |
--------------------------------------------------------------------------------
/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import { NgModule } from '@angular/core';
3 | import { FormsModule } from '@angular/forms';
4 | import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
5 |
6 | import { AppRoutingModule } from './app-routing.module';
7 | import { AppComponent } from './app.component';
8 | import { MainPageComponent } from './main-page/main-page.component';
9 | import { AddItemFormComponent } from './add-item-form/add-item-form.component';
10 | import { BudgetItemListComponent } from './budget-item-list/budget-item-list.component';
11 | import { BudgetItemCardComponent } from './budget-item-list/budget-item-card/budget-item-card.component';
12 | import { EditItemModalComponent } from './edit-item-modal/edit-item-modal.component';
13 |
14 | import { MatDialogModule } from '@angular/material';
15 |
16 | @NgModule({
17 | declarations: [
18 | AppComponent,
19 | MainPageComponent,
20 | AddItemFormComponent,
21 | BudgetItemListComponent,
22 | BudgetItemCardComponent,
23 | EditItemModalComponent
24 | ],
25 | imports: [
26 | BrowserModule,
27 | AppRoutingModule,
28 | FormsModule,
29 | BrowserAnimationsModule,
30 | MatDialogModule
31 | ],
32 | providers: [],
33 | entryComponents: [EditItemModalComponent],
34 | bootstrap: [AppComponent]
35 | })
36 | export class AppModule { }
37 |
--------------------------------------------------------------------------------
/src/app/budget-item-list/budget-item-card/budget-item-card.component.html:
--------------------------------------------------------------------------------
1 |
2 |
=0, 'expense': item.amount < 0 }">
3 |
4 |
{{ item.description }}
5 |
6 |
7 |
{{ item.amount }}
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/app/budget-item-list/budget-item-card/budget-item-card.component.scss:
--------------------------------------------------------------------------------
1 | @import '../../../main-styles.scss';
2 |
3 | .root {
4 | display: flex;
5 | width: 100%;
6 | position: relative;
7 |
8 | &:hover {
9 | .x-icon-button {
10 | opacity: 1;
11 | transform: scale(1);
12 | }
13 | }
14 |
15 | .x-icon-button {
16 | position: absolute;
17 | height: 34px;
18 | width: 34px;
19 | border-radius: 50%;
20 | background: $dark;
21 | background-image: url('../../../assets/delete_icon.svg');
22 | background-repeat: no-repeat;
23 | background-position: center;
24 | right: -17px; // this has to be half of the width
25 | top: -17px; // this has to be half of the height
26 |
27 | transition: opacity 0.2s ease-out, transform 0.2s ease-out;
28 |
29 | transform: scale(0);
30 | opacity: 0;
31 |
32 | cursor: pointer;
33 |
34 | &:hover {
35 | transform: scale(1.2);
36 | }
37 | }
38 | }
39 |
40 | .budget-item {
41 | display: flex;
42 | width: 100%;
43 | background-color: $light-grey;
44 | padding: 10px;
45 | border-radius: 5px;
46 | cursor: pointer;
47 |
48 | transition: background-color 0.2s ease-out;
49 | &:hover {
50 | background-color: darken($light-grey, 2%);
51 | }
52 |
53 | .description {
54 | display: flex;
55 | flex-grow: 1;
56 | font-size: 18px;
57 | margin-left: 5px;
58 |
59 | // Vertically center the children elements
60 | align-items: center;
61 | }
62 |
63 | .amount {
64 | padding: 5px;
65 | border-radius: 3px;
66 | }
67 | }
68 |
69 | .expense {
70 | p {
71 | color: $red;
72 | }
73 |
74 | .amount {
75 | background-color: $light-red;
76 | }
77 | }
78 |
79 | .income {
80 | p {
81 | color: $green;
82 | }
83 |
84 | .amount {
85 | background-color: $light-green;
86 | }
87 | }
--------------------------------------------------------------------------------
/src/app/budget-item-list/budget-item-card/budget-item-card.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { BudgetItemCardComponent } from './budget-item-card.component';
4 |
5 | describe('BudgetItemCardComponent', () => {
6 | let component: BudgetItemCardComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ BudgetItemCardComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(BudgetItemCardComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/budget-item-list/budget-item-card/budget-item-card.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
2 | import { BudgetItem } from 'src/shared/models/budget-item.model';
3 |
4 | @Component({
5 | selector: 'app-budget-item-card',
6 | templateUrl: './budget-item-card.component.html',
7 | styleUrls: ['./budget-item-card.component.scss']
8 | })
9 | export class BudgetItemCardComponent implements OnInit {
10 |
11 | @Input() item: BudgetItem;
12 | @Output() xButtonClick: EventEmitter = new EventEmitter();
13 | @Output() cardClick: EventEmitter = new EventEmitter();
14 |
15 | constructor() { }
16 |
17 | ngOnInit() {
18 | }
19 |
20 | onXButtonClick() {
21 | // here we want emit an event
22 | this.xButtonClick.emit();
23 | }
24 |
25 | onCardClick() {
26 | this.cardClick.emit();
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/app/budget-item-list/budget-item-list.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
Income
6 |
7 |
8 |
9 |
= 0"
11 | [item]="item"
12 | (xButtonClick)="onDeleteButtonClicked(item)"
13 | (cardClick)="onCardClicked(item)"
14 | style="display:block; margin-bottom: 20px">
15 |
16 |
17 |
18 |
19 |
20 |
21 |
Expenses
22 |
23 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/app/budget-item-list/budget-item-list.component.scss:
--------------------------------------------------------------------------------
1 | @import '../../main-styles.scss';
2 |
3 | .budget-items-section {
4 | display: flex;
5 | padding: 50px;
6 |
7 | // Horizontally and vertically center flex children
8 | justify-content: center;
9 | align-items: center;
10 |
11 | .budget-items-container {
12 | display: flex;
13 | max-width: 680px;
14 | height: 100%;
15 | width: 100%;
16 |
17 | .income-column, .expenses-column {
18 | display: flex;
19 | flex-direction: column;
20 | flex-basis: 0; // for the columns to be the same size, regardless of content
21 | flex-grow: 1;
22 |
23 | h1 {
24 | font-family: 'Lato';
25 | font-size: 24px;
26 | font-weight: 900;
27 | text-transform: uppercase;
28 | }
29 |
30 | .budget-items {
31 | display: flex;
32 | flex-direction: column;
33 |
34 | margin-top: 20px;
35 | }
36 | }
37 |
38 | .income-column {
39 | margin-right: 35px;
40 |
41 | h1 {
42 | color: $green;
43 | }
44 | }
45 |
46 | .expenses-column {
47 |
48 | h1 {
49 | color: $red;
50 | }
51 | }
52 | }
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/src/app/budget-item-list/budget-item-list.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { BudgetItemListComponent } from './budget-item-list.component';
4 |
5 | describe('BudgetItemListComponent', () => {
6 | let component: BudgetItemListComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ BudgetItemListComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(BudgetItemListComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/budget-item-list/budget-item-list.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
2 | import { BudgetItem } from 'src/shared/models/budget-item.model';
3 | import { MatDialog } from '@angular/material/dialog';
4 | import { EditItemModalComponent } from '../edit-item-modal/edit-item-modal.component';
5 |
6 | @Component({
7 | selector: 'app-budget-item-list',
8 | templateUrl: './budget-item-list.component.html',
9 | styleUrls: ['./budget-item-list.component.scss']
10 | })
11 | export class BudgetItemListComponent implements OnInit {
12 |
13 |
14 | @Input() budgetItems: BudgetItem[];
15 | @Output() delete: EventEmitter = new EventEmitter();
16 | @Output() update: EventEmitter = new EventEmitter();
17 |
18 | constructor(public dialog: MatDialog) { }
19 |
20 | ngOnInit() {
21 | }
22 |
23 | onDeleteButtonClicked(item: BudgetItem) {
24 | this.delete.emit(item);
25 | }
26 |
27 | onCardClicked(item: BudgetItem) {
28 | // show the edit modal
29 | const dialogRef = this.dialog.open(EditItemModalComponent, {
30 | width: '580px',
31 | data: item
32 | });
33 |
34 | dialogRef.afterClosed().subscribe(result => {
35 | // check if result has a value
36 | if (result) {
37 | this.update.emit({
38 | old: item,
39 | new: result
40 | });
41 | }
42 | })
43 | }
44 |
45 | }
46 |
47 |
48 | export interface UpdateEvent {
49 | old: BudgetItem;
50 | new: BudgetItem;
51 | }
52 |
--------------------------------------------------------------------------------
/src/app/edit-item-modal/edit-item-modal.component.html:
--------------------------------------------------------------------------------
1 | Edit
2 |
--------------------------------------------------------------------------------
/src/app/edit-item-modal/edit-item-modal.component.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devstackr/budget-app-angular/a0f0c89133421043c14b180c38a9bc3b0ba53a4c/src/app/edit-item-modal/edit-item-modal.component.scss
--------------------------------------------------------------------------------
/src/app/edit-item-modal/edit-item-modal.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { EditItemModalComponent } from './edit-item-modal.component';
4 |
5 | describe('EditItemModalComponent', () => {
6 | let component: EditItemModalComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ EditItemModalComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(EditItemModalComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/edit-item-modal/edit-item-modal.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, Inject } from '@angular/core';
2 | import { BudgetItem } from 'src/shared/models/budget-item.model';
3 | import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
4 |
5 | @Component({
6 | selector: 'app-edit-item-modal',
7 | templateUrl: './edit-item-modal.component.html',
8 | styleUrls: ['./edit-item-modal.component.scss']
9 | })
10 | export class EditItemModalComponent implements OnInit {
11 |
12 | constructor(
13 | public dialogRef: MatDialogRef,
14 | @Inject(MAT_DIALOG_DATA) public item: BudgetItem) { }
15 |
16 | ngOnInit() {
17 | }
18 |
19 | onSubmitted(updatedItem: BudgetItem) {
20 | this.dialogRef.close(updatedItem);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/app/main-page/main-page.component.html:
--------------------------------------------------------------------------------
1 |
2 |
Budget Calculator
3 |
4 |
5 |
6 | 0 }">{{ totalBudget }}
7 |
8 |
9 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/app/main-page/main-page.component.scss:
--------------------------------------------------------------------------------
1 | @import '../../main-styles.scss';
2 |
3 | .top-bar {
4 | display: flex;
5 | width: 100%;
6 | height: 68px;
7 | background: linear-gradient(75deg, rgb(214, 180, 247), rgb(173, 203, 231));
8 |
9 | // Horizontally and vertically center the text
10 | justify-content: center;
11 | align-items: center;
12 |
13 | h1 {
14 | font-family: 'Lato';
15 | font-size: 18px;
16 | letter-spacing: 1px;
17 | font-weight: 900;
18 | text-transform: uppercase;
19 | color: $dark;
20 | }
21 | }
22 |
23 | .total-budget-section {
24 | display: flex;
25 | height: 250px;
26 | background: $dark;
27 |
28 | // Horizontally and vertically center the text
29 | justify-content: center;
30 | align-items: center;
31 |
32 | h2 {
33 | font-family: 'Lato';
34 | font-weight: 300;
35 | font-size: 58px;
36 | color: white;
37 |
38 | &.green {
39 | color: lighten($green, 12%);
40 | }
41 |
42 | &.red {
43 | color: lighten($red, 12%);
44 | }
45 | }
46 | }
47 |
48 | .add-item-section {
49 | display: flex;
50 |
51 | // Horizontally and vertically center the text
52 | justify-content: center;
53 | align-items: center;
54 |
55 | .add-item-container {
56 | width: 680px;
57 | }
58 | }
--------------------------------------------------------------------------------
/src/app/main-page/main-page.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { MainPageComponent } from './main-page.component';
4 |
5 | describe('MainPageComponent', () => {
6 | let component: MainPageComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ MainPageComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(MainPageComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/main-page/main-page.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { BudgetItem } from 'src/shared/models/budget-item.model';
3 | import { UpdateEvent } from '../budget-item-list/budget-item-list.component';
4 |
5 | @Component({
6 | selector: 'app-main-page',
7 | templateUrl: './main-page.component.html',
8 | styleUrls: ['./main-page.component.scss']
9 | })
10 | export class MainPageComponent implements OnInit {
11 |
12 | budgetItems: BudgetItem[] = new Array();
13 | totalBudget: number = 0;
14 |
15 | constructor() { }
16 |
17 | ngOnInit() {
18 | }
19 |
20 | addItem(newItem: BudgetItem) {
21 | this.budgetItems.push(newItem);
22 | this.totalBudget += newItem.amount;
23 | }
24 |
25 | deleteItem(item: BudgetItem) {
26 | let index = this.budgetItems.indexOf(item);
27 | this.budgetItems.splice(index, 1);
28 | this.totalBudget -= item.amount;
29 | }
30 |
31 | updateItem(updateEvent: UpdateEvent) {
32 | // result is the update budget item
33 | // replace the item with the updated/submitted item from the form
34 | this.budgetItems[this.budgetItems.indexOf(updateEvent.old)] = updateEvent.new;
35 |
36 | // update the total budget
37 | this.totalBudget -= updateEvent.old.amount;
38 | this.totalBudget += updateEvent.new.amount;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devstackr/budget-app-angular/a0f0c89133421043c14b180c38a9bc3b0ba53a4c/src/assets/.gitkeep
--------------------------------------------------------------------------------
/src/assets/delete_icon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
64 |
--------------------------------------------------------------------------------
/src/assets/screenshots/01_Budget_App_Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devstackr/budget-app-angular/a0f0c89133421043c14b180c38a9bc3b0ba53a4c/src/assets/screenshots/01_Budget_App_Screenshot.png
--------------------------------------------------------------------------------
/src/assets/screenshots/02_Budget_App_Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devstackr/budget-app-angular/a0f0c89133421043c14b180c38a9bc3b0ba53a4c/src/assets/screenshots/02_Budget_App_Screenshot.png
--------------------------------------------------------------------------------
/src/assets/screenshots/03_Budget_App_Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devstackr/budget-app-angular/a0f0c89133421043c14b180c38a9bc3b0ba53a4c/src/assets/screenshots/03_Budget_App_Screenshot.png
--------------------------------------------------------------------------------
/src/assets/screenshots/04_Budget_App_Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devstackr/budget-app-angular/a0f0c89133421043c14b180c38a9bc3b0ba53a4c/src/assets/screenshots/04_Budget_App_Screenshot.png
--------------------------------------------------------------------------------
/src/assets/screenshots/05_Budget_App_Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devstackr/budget-app-angular/a0f0c89133421043c14b180c38a9bc3b0ba53a4c/src/assets/screenshots/05_Budget_App_Screenshot.png
--------------------------------------------------------------------------------
/src/assets/thumbnail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devstackr/budget-app-angular/a0f0c89133421043c14b180c38a9bc3b0ba53a4c/src/assets/thumbnail.png
--------------------------------------------------------------------------------
/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 | #
5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
6 |
7 | > 0.5%
8 | last 2 versions
9 | Firefox ESR
10 | not dead
11 | not IE 9-11
--------------------------------------------------------------------------------
/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Devstackr/budget-app-angular/a0f0c89133421043c14b180c38a9bc3b0ba53a4c/src/favicon.ico
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BudgetApp
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../coverage'),
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 | });
31 | };
--------------------------------------------------------------------------------
/src/main-styles.scss:
--------------------------------------------------------------------------------
1 | // defining the global styles and changing variables
2 |
3 | @charset "utf-8";
4 |
5 | // Import a Google Font
6 | @import url('https://fonts.googleapis.com/css?family=Nunito:400,700|Lato:300,900');
7 |
8 | // Set your brand colors
9 | $purple: rgb(159, 104, 235);
10 | $light-grey: #f5f5f5;
11 | $dark: rgb(22, 28, 41);
12 |
13 |
14 | $green: #00cc86;
15 | $light-green: #bafacd;
16 |
17 | $red: #dc3900;
18 | $light-red: #ffe5e3;
19 |
20 | // Update Bulma's global variables
21 | $family-sans-serif: "Nunito", sans-serif;
22 | $primary: $purple;
23 | $link: $purple;
24 |
25 | // Update some of Bulma's component variables
26 | $body-background-color: white;
27 | $control-border-width: 2px;
28 | $input-border-color: transparent;
29 | $input-background-color: $light-grey;
30 | $input-shadow: none;
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 | /** IE9, IE10, IE11, and Chrome <55 requires all of the following polyfills.
22 | * This also includes Android Emulators with older versions of Chrome and Google Search/Googlebot
23 | */
24 |
25 | // import 'core-js/es6/symbol';
26 | // import 'core-js/es6/object';
27 | // import 'core-js/es6/function';
28 | // import 'core-js/es6/parse-int';
29 | // import 'core-js/es6/parse-float';
30 | // import 'core-js/es6/number';
31 | // import 'core-js/es6/math';
32 | // import 'core-js/es6/string';
33 | // import 'core-js/es6/date';
34 | // import 'core-js/es6/array';
35 | // import 'core-js/es6/regexp';
36 | // import 'core-js/es6/map';
37 | // import 'core-js/es6/weak-map';
38 | // import 'core-js/es6/set';
39 |
40 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
41 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
42 |
43 | /** IE10 and IE11 requires the following for the Reflect API. */
44 | // import 'core-js/es6/reflect';
45 |
46 | /**
47 | * Web Animations `@angular/platform-browser/animations`
48 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
49 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
50 | */
51 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
52 |
53 | /**
54 | * By default, zone.js will patch all possible macroTask and DomEvents
55 | * user can disable parts of macroTask/DomEvents patch by setting following flags
56 | * because those flags need to be set before `zone.js` being loaded, and webpack
57 | * will put import in the top of bundle, so user need to create a separate file
58 | * in this directory (for example: zone-flags.ts), and put the following flags
59 | * into that file, and then add the following code before importing zone.js.
60 | * import './zone-flags.ts';
61 | *
62 | * The flags allowed in zone-flags.ts are listed here.
63 | *
64 | * The following flags will work for all browsers.
65 | *
66 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
67 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
68 | * (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
69 | *
70 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
71 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
72 | *
73 | * (window as any).__Zone_enable_cross_context_check = true;
74 | *
75 | */
76 |
77 | /***************************************************************************************************
78 | * Zone JS is required by default for Angular itself.
79 | */
80 | import 'zone.js/dist/zone'; // Included with Angular CLI.
81 |
82 |
83 | /***************************************************************************************************
84 | * APPLICATION IMPORTS
85 | */
86 |
--------------------------------------------------------------------------------
/src/shared/models/budget-item.model.ts:
--------------------------------------------------------------------------------
1 | export class BudgetItem {
2 |
3 | constructor(public description: string, public amount: number) { }
4 | }
--------------------------------------------------------------------------------
/src/styles.scss:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
3 | @import 'main-styles';
4 | @import '../node_modules/bulma/bulma.sass';
5 |
6 | @import "~@angular/material/prebuilt-themes/indigo-pink.css";
--------------------------------------------------------------------------------
/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: any;
11 |
12 | // First, initialize the Angular testing environment.
13 | getTestBed().initTestEnvironment(
14 | BrowserDynamicTestingModule,
15 | platformBrowserDynamicTesting()
16 | );
17 | // Then we find all the tests.
18 | const context = require.context('./', true, /\.spec\.ts$/);
19 | // And load the modules.
20 | context.keys().map(context);
21 |
--------------------------------------------------------------------------------
/src/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "types": []
6 | },
7 | "exclude": [
8 | "test.ts",
9 | "**/*.spec.ts"
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/src/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "test.ts",
12 | "polyfills.ts"
13 | ],
14 | "include": [
15 | "**/*.spec.ts",
16 | "**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/src/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "outDir": "./dist/out-tsc",
6 | "sourceMap": true,
7 | "declaration": false,
8 | "module": "es2015",
9 | "moduleResolution": "node",
10 | "emitDecoratorMetadata": true,
11 | "experimentalDecorators": true,
12 | "importHelpers": true,
13 | "target": "es5",
14 | "typeRoots": [
15 | "node_modules/@types"
16 | ],
17 | "lib": [
18 | "es2018",
19 | "dom"
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rulesDirectory": [
3 | "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-redundant-jsdoc": true,
69 | "no-shadowed-variable": true,
70 | "no-string-literal": false,
71 | "no-string-throw": true,
72 | "no-switch-case-fall-through": true,
73 | "no-trailing-whitespace": true,
74 | "no-unnecessary-initializer": true,
75 | "no-unused-expression": true,
76 | "no-use-before-declare": true,
77 | "no-var-keyword": true,
78 | "object-literal-sort-keys": false,
79 | "one-line": [
80 | true,
81 | "check-open-brace",
82 | "check-catch",
83 | "check-else",
84 | "check-whitespace"
85 | ],
86 | "prefer-const": true,
87 | "quotemark": [
88 | true,
89 | "single"
90 | ],
91 | "radix": true,
92 | "semicolon": [
93 | true,
94 | "always"
95 | ],
96 | "triple-equals": [
97 | true,
98 | "allow-null-check"
99 | ],
100 | "typedef-whitespace": [
101 | true,
102 | {
103 | "call-signature": "nospace",
104 | "index-signature": "nospace",
105 | "parameter": "nospace",
106 | "property-declaration": "nospace",
107 | "variable-declaration": "nospace"
108 | }
109 | ],
110 | "unified-signatures": true,
111 | "variable-name": false,
112 | "whitespace": [
113 | true,
114 | "check-branch",
115 | "check-decl",
116 | "check-operator",
117 | "check-separator",
118 | "check-type"
119 | ],
120 | "no-output-on-prefix": true,
121 | "use-input-property-decorator": true,
122 | "use-output-property-decorator": true,
123 | "use-host-property-decorator": true,
124 | "no-input-rename": true,
125 | "no-output-rename": true,
126 | "use-life-cycle-interface": true,
127 | "use-pipe-transform-interface": true,
128 | "component-class-suffix": true,
129 | "directive-class-suffix": true
130 | }
131 | }
132 |
--------------------------------------------------------------------------------