├── .browserslistrc ├── .editorconfig ├── .gitignore ├── README.md ├── angular.json ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── src ├── app │ ├── actions │ │ └── posts.actions.ts │ ├── app-routing.module.ts │ ├── app.component.html │ ├── app.component.scss │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── components │ │ └── posts │ │ │ ├── add-post │ │ │ ├── add-post.component.html │ │ │ ├── add-post.component.scss │ │ │ ├── add-post.component.spec.ts │ │ │ └── add-post.component.ts │ │ │ ├── delete-post │ │ │ ├── delete-post.component.html │ │ │ ├── delete-post.component.scss │ │ │ ├── delete-post.component.spec.ts │ │ │ └── delete-post.component.ts │ │ │ └── posts │ │ │ ├── posts.component.html │ │ │ ├── posts.component.scss │ │ │ ├── posts.component.spec.ts │ │ │ └── posts.component.ts │ ├── effects │ │ └── post.effects.ts │ ├── models │ │ ├── app-state.model.ts │ │ └── post.model.ts │ ├── reducers │ │ └── posts.reducer.ts │ └── services │ │ ├── posts.service.spec.ts │ │ └── posts.service.ts ├── assets │ ├── .gitkeep │ └── images │ │ └── sand-clock.png ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── polyfills.ts ├── styles.scss └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json └── tslint.json /.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /.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 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NgrxApp 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.0.2. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. 28 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "ngrx-app": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | } 12 | }, 13 | "root": "", 14 | "sourceRoot": "src", 15 | "prefix": "app", 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "dist/ngrx-app", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "polyfills": "src/polyfills.ts", 24 | "tsConfig": "tsconfig.app.json", 25 | "aot": true, 26 | "assets": [ 27 | "src/favicon.ico", 28 | "src/assets" 29 | ], 30 | "styles": [ 31 | "src/styles.scss" 32 | ], 33 | "scripts": [] 34 | }, 35 | "configurations": { 36 | "production": { 37 | "fileReplacements": [ 38 | { 39 | "replace": "src/environments/environment.ts", 40 | "with": "src/environments/environment.prod.ts" 41 | } 42 | ], 43 | "optimization": true, 44 | "outputHashing": "all", 45 | "sourceMap": false, 46 | "namedChunks": false, 47 | "extractLicenses": true, 48 | "vendorChunk": false, 49 | "buildOptimizer": true, 50 | "budgets": [ 51 | { 52 | "type": "initial", 53 | "maximumWarning": "2mb", 54 | "maximumError": "5mb" 55 | }, 56 | { 57 | "type": "anyComponentStyle", 58 | "maximumWarning": "6kb", 59 | "maximumError": "10kb" 60 | } 61 | ] 62 | } 63 | } 64 | }, 65 | "serve": { 66 | "builder": "@angular-devkit/build-angular:dev-server", 67 | "options": { 68 | "browserTarget": "ngrx-app:build" 69 | }, 70 | "configurations": { 71 | "production": { 72 | "browserTarget": "ngrx-app:build:production" 73 | } 74 | } 75 | }, 76 | "extract-i18n": { 77 | "builder": "@angular-devkit/build-angular:extract-i18n", 78 | "options": { 79 | "browserTarget": "ngrx-app:build" 80 | } 81 | }, 82 | "test": { 83 | "builder": "@angular-devkit/build-angular:karma", 84 | "options": { 85 | "main": "src/test.ts", 86 | "polyfills": "src/polyfills.ts", 87 | "tsConfig": "tsconfig.spec.json", 88 | "karmaConfig": "karma.conf.js", 89 | "assets": [ 90 | "src/favicon.ico", 91 | "src/assets" 92 | ], 93 | "styles": [ 94 | "src/styles.scss" 95 | ], 96 | "scripts": [] 97 | } 98 | }, 99 | "lint": { 100 | "builder": "@angular-devkit/build-angular:tslint", 101 | "options": { 102 | "tsConfig": [ 103 | "tsconfig.app.json", 104 | "tsconfig.spec.json", 105 | "e2e/tsconfig.json" 106 | ], 107 | "exclude": [ 108 | "**/node_modules/**" 109 | ] 110 | } 111 | }, 112 | "e2e": { 113 | "builder": "@angular-devkit/build-angular:protractor", 114 | "options": { 115 | "protractorConfig": "e2e/protractor.conf.js", 116 | "devServerTarget": "ngrx-app:serve" 117 | }, 118 | "configurations": { 119 | "production": { 120 | "devServerTarget": "ngrx-app:serve:production" 121 | } 122 | } 123 | } 124 | } 125 | } 126 | }, 127 | "defaultProject": "ngrx-app" 128 | } 129 | -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | SELENIUM_PROMISE_MANAGER: false, 20 | baseUrl: 'http://localhost:4200/', 21 | framework: 'jasmine', 22 | jasmineNodeOpts: { 23 | showColors: true, 24 | defaultTimeoutInterval: 30000, 25 | print: function() {} 26 | }, 27 | onPrepare() { 28 | require('ts-node').register({ 29 | project: require('path').join(__dirname, './tsconfig.json') 30 | }); 31 | jasmine.getEnv().addReporter(new SpecReporter({ 32 | spec: { 33 | displayStacktrace: StacktraceOption.PRETTY 34 | } 35 | })); 36 | } 37 | }; -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', async () => { 12 | await page.navigateTo(); 13 | expect(await page.getTitleText()).toEqual('ngrx-app app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | async navigateTo(): Promise { 5 | return browser.get(browser.baseUrl); 6 | } 7 | 8 | async getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../out-tsc/e2e", 6 | "module": "commonjs", 7 | "target": "es2018", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /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'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | jasmineHtmlReporter: { 19 | suppressAll: true // removes the duplicated traces 20 | }, 21 | coverageReporter: { 22 | dir: require('path').join(__dirname, './coverage/ngrx-app'), 23 | subdir: '.', 24 | reporters: [ 25 | { type: 'html' }, 26 | { type: 'text-summary' } 27 | ] 28 | }, 29 | reporters: ['progress', 'kjhtml'], 30 | port: 9876, 31 | colors: true, 32 | logLevel: config.LOG_INFO, 33 | autoWatch: true, 34 | browsers: ['Chrome'], 35 | singleRun: false, 36 | restartOnFileChange: true 37 | }); 38 | }; 39 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ngrx-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": "~11.0.1", 15 | "@angular/common": "~11.0.1", 16 | "@angular/compiler": "~11.0.1", 17 | "@angular/core": "~11.0.1", 18 | "@angular/forms": "~11.0.1", 19 | "@angular/platform-browser": "~11.0.1", 20 | "@angular/platform-browser-dynamic": "~11.0.1", 21 | "@angular/router": "~11.0.1", 22 | "@ngrx/effects": "^10.0.1", 23 | "@ngrx/store": "^10.0.1", 24 | "@ngrx/store-devtools": "^10.0.1", 25 | "rxjs": "~6.6.0", 26 | "tslib": "^2.0.0", 27 | "zone.js": "~0.10.2" 28 | }, 29 | "devDependencies": { 30 | "@angular-devkit/build-angular": "~0.1100.2", 31 | "@angular/cli": "~11.0.2", 32 | "@angular/compiler-cli": "~11.0.1", 33 | "@types/jasmine": "~3.6.0", 34 | "@types/node": "^12.11.1", 35 | "codelyzer": "^6.0.0", 36 | "jasmine-core": "~3.6.0", 37 | "jasmine-spec-reporter": "~5.0.0", 38 | "karma": "~5.1.0", 39 | "karma-chrome-launcher": "~3.1.0", 40 | "karma-coverage": "~2.0.3", 41 | "karma-jasmine": "~4.0.0", 42 | "karma-jasmine-html-reporter": "^1.5.0", 43 | "protractor": "~7.0.0", 44 | "ts-node": "~8.3.0", 45 | "tslint": "~6.1.0", 46 | "typescript": "~4.0.2" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/app/actions/posts.actions.ts: -------------------------------------------------------------------------------- 1 | import { Action } from '@ngrx/store'; 2 | import Post from '../models/post.model'; 3 | 4 | export enum PostActionTypes { 5 | ADD_POST = '[POST] Add Post', 6 | ADD_POST_SUCCESS = '[POST] Add Post Success', 7 | ADD_POST_FAIL = '[POST] Add Post Fail', 8 | 9 | GET_POSTS = '[POST] Get Posts', 10 | GET_POSTS_SUCCESS = '[POST] Get Posts Success', 11 | GET_POSTS_FAIL = '[POST] Get Posts Fail', 12 | 13 | DELETE_POST = '[POST] Delete Post', 14 | DELETE_POST_SUCCESS = '[POST] Delete Post Success', 15 | DELETE_POST_FAIL = '[POST] Delete Post Fail', 16 | } 17 | 18 | /* 19 | ** Get Posts 20 | **/ 21 | export class GetPostsAction implements Action { 22 | readonly type = PostActionTypes.GET_POSTS; 23 | } 24 | 25 | export class GetPostsSuccessAction implements Action { 26 | readonly type = PostActionTypes.GET_POSTS_SUCCESS; 27 | constructor(public payload: Post[]){} 28 | } 29 | 30 | export class GetPostsFailAction implements Action { 31 | readonly type = PostActionTypes.GET_POSTS_FAIL; 32 | constructor(public payload: any) {} 33 | } 34 | 35 | /* 36 | ** End - Get Posts 37 | **/ 38 | 39 | 40 | /* 41 | ** Add Post 42 | **/ 43 | export class AddPostAction implements Action { 44 | readonly type = PostActionTypes.ADD_POST; 45 | constructor(public payload: Post){} 46 | } 47 | 48 | export class AddPostSuccessAction implements Action { 49 | readonly type = PostActionTypes.ADD_POST_SUCCESS; 50 | constructor(public payload: Post){} 51 | } 52 | 53 | export class AddPostFailAction implements Action { 54 | readonly type = PostActionTypes.ADD_POST_FAIL; 55 | constructor(public payload: any){} 56 | } 57 | 58 | /* 59 | ** End - Add Post 60 | **/ 61 | 62 | 63 | /* 64 | ** Delete Post 65 | **/ 66 | export class DeletePostAction implements Action { 67 | readonly type = PostActionTypes.DELETE_POST; 68 | constructor(public payload: number){} 69 | } 70 | 71 | export class DeletePostSuccessAction implements Action { 72 | readonly type = PostActionTypes.DELETE_POST_SUCCESS; 73 | constructor(public payload: string | any){} 74 | } 75 | 76 | export class DeletePostFailAction implements Action { 77 | readonly type = PostActionTypes.DELETE_POST_FAIL; 78 | constructor(public payload: any){} 79 | } 80 | 81 | /* 82 | ** End - Delete Post 83 | **/ 84 | 85 | export type PostAction = 86 | AddPostAction | 87 | AddPostSuccessAction | 88 | AddPostFailAction | 89 | DeletePostAction | 90 | DeletePostSuccessAction | 91 | DeletePostFailAction | 92 | GetPostsAction | 93 | GetPostsSuccessAction | 94 | GetPostsFailAction; -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | 4 | const routes: Routes = []; 5 | 6 | @NgModule({ 7 | imports: [RouterModule.forRoot(routes)], 8 | exports: [RouterModule] 9 | }) 10 | export class AppRoutingModule { } 11 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |
6 | 7 | -------------------------------------------------------------------------------- /src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | .post-app{ 2 | width: 400px; 3 | margin: 0 auto; 4 | padding: 25px; 5 | position: relative; 6 | } 7 | .loading-icon{ 8 | height: 50px; 9 | position: fixed; 10 | top: 20px; 11 | right: 20px; 12 | } -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } 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 | await 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.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'ngrx-app'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('ngrx-app'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement; 33 | expect(compiled.querySelector('.content span').textContent).toContain('ngrx-app app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Observable } from 'rxjs'; 3 | import { Store } from '@ngrx/store'; 4 | 5 | import AppState from './models/app-state.model'; 6 | 7 | @Component({ 8 | selector: 'app-root', 9 | templateUrl: './app.component.html', 10 | styleUrls: ['./app.component.scss'] 11 | }) 12 | export class AppComponent implements OnInit { 13 | title = 'ngrx-app'; 14 | loading$: Observable; 15 | 16 | constructor(private store: Store) { } 17 | 18 | ngOnInit(): void { 19 | this.loading$ = this.store.select(store => store.post.loading); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /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 { StoreModule } from '@ngrx/store'; 5 | import { HttpClientModule } from '@angular/common/http'; 6 | import { StoreDevtoolsModule } from '@ngrx/store-devtools'; 7 | import { environment } from '../environments/environment'; 8 | import { EffectsModule } from '@ngrx/effects'; 9 | 10 | import { AppRoutingModule } from './app-routing.module'; 11 | import { AppComponent } from './app.component'; 12 | import { PostsComponent } from './components/posts/posts/posts.component'; 13 | import { PostsReducer} from './reducers/posts.reducer'; 14 | import { AddPostComponent } from './components/posts/add-post/add-post.component'; 15 | import { DeletePostComponent } from './components/posts/delete-post/delete-post.component'; 16 | import { PostEffects } from './effects/post.effects'; 17 | 18 | 19 | @NgModule({ 20 | declarations: [ 21 | AppComponent, 22 | PostsComponent, 23 | AddPostComponent, 24 | DeletePostComponent 25 | ], 26 | imports: [ 27 | BrowserModule, 28 | AppRoutingModule, 29 | FormsModule, 30 | HttpClientModule, 31 | StoreModule.forRoot({ 32 | post: PostsReducer 33 | }, {}), 34 | StoreDevtoolsModule.instrument({ maxAge: 25, logOnly: environment.production }), 35 | EffectsModule.forRoot([ 36 | PostEffects 37 | ]) 38 | ], 39 | providers: [], 40 | bootstrap: [AppComponent] 41 | }) 42 | export class AppModule { } 43 | -------------------------------------------------------------------------------- /src/app/components/posts/add-post/add-post.component.html: -------------------------------------------------------------------------------- 1 |

Create A Post

2 |
3 |
4 |
5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 |
14 |
-------------------------------------------------------------------------------- /src/app/components/posts/add-post/add-post.component.scss: -------------------------------------------------------------------------------- 1 | .add-post{ 2 | margin: 20px 10px; 3 | textarea, input{ 4 | width: 100%; 5 | margin-bottom: 15px; 6 | &:focus{ 7 | outline: none; 8 | }; 9 | padding: 5px 10px; 10 | }; 11 | input[type="text"]{ 12 | border: 3px solid #ff7a7a; 13 | height: 40px; 14 | }; 15 | textarea{ 16 | border: 3px solid #696363; 17 | height: 60px; 18 | }; 19 | input[type="button"]{ 20 | background: #ff7a7a; 21 | color: white; 22 | width: auto; 23 | border: none; 24 | &:hover{ 25 | cursor: pointer; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/app/components/posts/add-post/add-post.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AddPostComponent } from './add-post.component'; 4 | 5 | describe('AddPostComponent', () => { 6 | let component: AddPostComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ AddPostComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(AddPostComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/posts/add-post/add-post.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {Store} from '@ngrx/store'; 3 | 4 | import AppState from '../../../models/app-state.model'; 5 | import Post from '../../../models/post.model'; 6 | import {AddPostAction, PostAction} from '../../../actions/posts.actions'; 7 | 8 | @Component({ 9 | selector: 'app-add-post', 10 | templateUrl: './add-post.component.html', 11 | styleUrls: ['./add-post.component.scss'] 12 | }) 13 | export class AddPostComponent implements OnInit { 14 | 15 | post: Post = { 16 | id: null, 17 | userId: null, 18 | title: '', 19 | body: '' 20 | } 21 | 22 | constructor(private store: Store) { } 23 | 24 | ngOnInit(): void { 25 | } 26 | 27 | createPost(){ 28 | this.post.id = Math.floor(Math.random() * 10); 29 | this.post.userId = Math.floor(Math.random() * 100); 30 | this.store.dispatch(new AddPostAction({...this.post})); 31 | this.post.title = ''; 32 | this.post.body = ''; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/app/components/posts/delete-post/delete-post.component.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/posts/delete-post/delete-post.component.scss: -------------------------------------------------------------------------------- 1 | span{ 2 | height: 25px; 3 | display: block; 4 | } -------------------------------------------------------------------------------- /src/app/components/posts/delete-post/delete-post.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { DeletePostComponent } from './delete-post.component'; 4 | 5 | describe('DeletePostComponent', () => { 6 | let component: DeletePostComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ DeletePostComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(DeletePostComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/posts/delete-post/delete-post.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input } from '@angular/core'; 2 | import {Store} from '@ngrx/store'; 3 | import AppState from '../../../models/app-state.model'; 4 | import {DeletePostAction} from '../../../actions/posts.actions'; 5 | 6 | @Component({ 7 | selector: 'app-delete-post', 8 | templateUrl: './delete-post.component.html', 9 | styleUrls: ['./delete-post.component.scss'] 10 | }) 11 | export class DeletePostComponent implements OnInit { 12 | 13 | @Input() 14 | index: number; 15 | 16 | constructor(private store: Store) { } 17 | 18 | ngOnInit(): void { 19 | } 20 | 21 | deletePost(){ 22 | this.store.dispatch(new DeletePostAction(this.index)); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/app/components/posts/posts/posts.component.html: -------------------------------------------------------------------------------- 1 |

My Posts

2 |
3 |

No posts to show...

4 |
    5 |
  • 6 |

    {{post.title}}

    7 |

    {{post.body}}

    8 | 9 |
    10 |
  • 11 |
12 |
-------------------------------------------------------------------------------- /src/app/components/posts/posts/posts.component.scss: -------------------------------------------------------------------------------- 1 | .posts{ 2 | background: #cacaca; 3 | border-radius: 50px; 4 | padding: 20px; 5 | ul{ 6 | padding-left: 0; 7 | } 8 | li{ 9 | list-style-type: none; 10 | position: relative; 11 | &:hover{ 12 | span{ 13 | display: block; 14 | } 15 | } 16 | p{ 17 | &:first-child{ 18 | font-weight: bold; 19 | } 20 | } 21 | span{ 22 | background: #ca3c3c; 23 | color: white; 24 | border-radius: 5px; 25 | cursor: pointer; 26 | font-size: 12px; 27 | height: 30px; 28 | width: 30px; 29 | text-align: center; 30 | border-radius: 15px; 31 | padding-top: 7px; 32 | position: absolute; 33 | top: -10px; 34 | right: -10px; 35 | display: none; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/app/components/posts/posts/posts.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PostsComponent } from './posts.component'; 4 | 5 | describe('PostsComponent', () => { 6 | let component: PostsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ PostsComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PostsComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/posts/posts/posts.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Store } from '@ngrx/store'; 3 | import { Observable } from 'rxjs'; 4 | 5 | import Post from '../../../models/post.model'; 6 | import AppState from '../../../models/app-state.model'; 7 | import { GetPostsAction } from '../../../actions/posts.actions'; 8 | 9 | @Component({ 10 | selector: 'app-posts', 11 | templateUrl: './posts.component.html', 12 | styleUrls: ['./posts.component.scss'] 13 | }) 14 | export class PostsComponent implements OnInit { 15 | 16 | posts$: Observable; 17 | loading$: Observable; 18 | error$: Observable 19 | 20 | constructor(private store: Store) { } 21 | 22 | ngOnInit(): void { 23 | this.posts$ = this.store.select(store => store.post.posts); 24 | this.error$ = this.store.select(store => store.post.error); 25 | this.store.dispatch(new GetPostsAction()); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/app/effects/post.effects.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Actions, Effect, ofType } from '@ngrx/effects'; 3 | import { map, mergeMap, catchError } from 'rxjs/operators'; 4 | import { of } from 'rxjs'; 5 | 6 | import { 7 | PostActionTypes, 8 | GetPostsAction, 9 | GetPostsSuccessAction, 10 | GetPostsFailAction, 11 | DeletePostAction, 12 | DeletePostSuccessAction, 13 | DeletePostFailAction, 14 | AddPostAction, 15 | AddPostSuccessAction, 16 | AddPostFailAction 17 | } from '../actions/posts.actions' 18 | import { PostsService } from '../services/posts.service'; 19 | 20 | @Injectable() 21 | export class PostEffects { 22 | 23 | @Effect() getPosts$ = this.actions$ 24 | .pipe( 25 | ofType(PostActionTypes.GET_POSTS), 26 | mergeMap( 27 | () => this.service.getPosts() 28 | .pipe( 29 | map(data => { 30 | return new GetPostsSuccessAction(data) 31 | }), 32 | catchError(error => of(new GetPostsFailAction(error))) 33 | ) 34 | ), 35 | ) 36 | 37 | @Effect() deletePost$ = this.actions$ 38 | .pipe( 39 | ofType(PostActionTypes.DELETE_POST), 40 | mergeMap( 41 | (data) => this.service.deletePost(data.payload) 42 | .pipe( 43 | map(data2 => { 44 | return new DeletePostSuccessAction(data.payload) 45 | }), 46 | catchError(error => of(new DeletePostFailAction(error))) 47 | ) 48 | ), 49 | ) 50 | 51 | @Effect() addPost$ = this.actions$ 52 | .pipe( 53 | ofType(PostActionTypes.ADD_POST), 54 | mergeMap( 55 | (data) => this.service.addPost(data.payload) 56 | .pipe( 57 | map(data2 => { 58 | return new AddPostSuccessAction(data.payload) 59 | }), 60 | catchError(error => of(new AddPostFailAction(error))) 61 | ) 62 | ), 63 | ) 64 | 65 | constructor( 66 | private actions$: Actions, 67 | private service: PostsService 68 | ) { } 69 | } -------------------------------------------------------------------------------- /src/app/models/app-state.model.ts: -------------------------------------------------------------------------------- 1 | import Post from './post.model'; 2 | import { PostState } from '../reducers/posts.reducer'; 3 | 4 | export default interface AppState { 5 | post: PostState; 6 | } 7 | 8 | 9 | 10 | // StoreModule.forRoot({ 11 | // post: PostsReducer 12 | // }, {}), -------------------------------------------------------------------------------- /src/app/models/post.model.ts: -------------------------------------------------------------------------------- 1 | export default interface Post{ 2 | userId: number; 3 | id: number; 4 | title: string; 5 | body: string; 6 | } -------------------------------------------------------------------------------- /src/app/reducers/posts.reducer.ts: -------------------------------------------------------------------------------- 1 | import {PostActionTypes, PostAction} from '../actions/posts.actions'; 2 | import Post from '../models/post.model'; 3 | 4 | export interface PostState { 5 | posts: Post[], 6 | loading: boolean, 7 | error: string | any 8 | } 9 | 10 | const initialState: PostState = { 11 | posts: 12 | [ 13 | { 14 | id: 1, 15 | userId: 1, 16 | title: "First Post", 17 | body: "when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries" 18 | }, 19 | { 20 | id: 2, 21 | userId: 1, 22 | title: "Second Post", 23 | body: "when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries" 24 | } 25 | ], 26 | loading: false, 27 | error: "" 28 | } 29 | 30 | export function PostsReducer(state: PostState = initialState, action: PostAction){ 31 | switch(action.type){ 32 | 33 | case PostActionTypes.ADD_POST: 34 | return { 35 | ...state, 36 | loading: true 37 | } 38 | case PostActionTypes.ADD_POST_SUCCESS: 39 | return { 40 | ...state, 41 | posts: [action.payload, ...state.posts], 42 | loading: false 43 | } 44 | case PostActionTypes.ADD_POST_FAIL: 45 | return { 46 | ...state, 47 | error: action.payload, 48 | loading: false 49 | }; 50 | 51 | case PostActionTypes.DELETE_POST: 52 | return { 53 | ...state, 54 | loading: true 55 | } 56 | case PostActionTypes.DELETE_POST_SUCCESS:{ 57 | let updatedPosts = [...state.posts]; 58 | updatedPosts.splice(action.payload, 1); 59 | return { 60 | ...state, 61 | posts: updatedPosts, 62 | loading: false 63 | }; 64 | } 65 | case PostActionTypes.DELETE_POST_FAIL: 66 | return { 67 | ...state, 68 | error: action.payload, 69 | loading: false 70 | } 71 | case PostActionTypes.GET_POSTS: 72 | return { 73 | ...state, 74 | loading: true 75 | } 76 | case PostActionTypes.GET_POSTS_SUCCESS: 77 | return { 78 | ...state, 79 | posts: action.payload, 80 | loading: false 81 | } 82 | case PostActionTypes.GET_POSTS_FAIL: 83 | return { 84 | ...state, 85 | error: action.payload, 86 | loading: false 87 | } 88 | default: 89 | return state; 90 | } 91 | } -------------------------------------------------------------------------------- /src/app/services/posts.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { PostsService } from './posts.service'; 4 | 5 | describe('PostsService', () => { 6 | let service: PostsService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(PostsService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/services/posts.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | 4 | import Post from '../models/post.model'; 5 | 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class PostsService { 11 | 12 | baseUrl = 'https://jsonplaceholder.typicode.com'; 13 | 14 | constructor(private http: HttpClient) { } 15 | 16 | getPosts() { 17 | return this.http.get(`${this.baseUrl}/posts?_limit=10`); 18 | } 19 | 20 | addPost(post: Post){ 21 | return this.http.post(`${this.baseUrl}/posts`, post); 22 | } 23 | 24 | deletePost(id: Number){ 25 | return this.http.delete(`${this.baseUrl}/posts/${id}`); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usmannaveed1994/angular-ngrx-app/526992de4a735d30c1b922fa4ec83f091135d3ca/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/assets/images/sand-clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usmannaveed1994/angular-ngrx-app/526992de4a735d30c1b922fa4ec83f091135d3ca/src/assets/images/sand-clock.png -------------------------------------------------------------------------------- /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/usmannaveed1994/angular-ngrx-app/526992de4a735d30c1b922fa4ec83f091135d3ca/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NgrxApp 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /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 | /** IE11 requires the following for NgClass support on SVG elements */ 22 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 23 | 24 | /** 25 | * Web Animations `@angular/platform-browser/animations` 26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 28 | */ 29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 30 | 31 | /** 32 | * By default, zone.js will patch all possible macroTask and DomEvents 33 | * user can disable parts of macroTask/DomEvents patch by setting following flags 34 | * because those flags need to be set before `zone.js` being loaded, and webpack 35 | * will put import in the top of bundle, so user need to create a separate file 36 | * in this directory (for example: zone-flags.ts), and put the following flags 37 | * into that file, and then add the following code before importing zone.js. 38 | * import './zone-flags'; 39 | * 40 | * The flags allowed in zone-flags.ts are listed here. 41 | * 42 | * The following flags will work for all browsers. 43 | * 44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 47 | * 48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 50 | * 51 | * (window as any).__Zone_enable_cross_context_check = true; 52 | * 53 | */ 54 | 55 | /*************************************************************************************************** 56 | * Zone JS is required by default for Angular itself. 57 | */ 58 | import 'zone.js/dist/zone'; // Included with Angular CLI. 59 | 60 | 61 | /*************************************************************************************************** 62 | * APPLICATION IMPORTS 63 | */ 64 | -------------------------------------------------------------------------------- /src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | body *{ 3 | font-family: 'Open Sans', sans-serif; 4 | box-sizing: border-box; 5 | } 6 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "sourceMap": true, 8 | "declaration": false, 9 | "downlevelIteration": true, 10 | "experimentalDecorators": true, 11 | "moduleResolution": "node", 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "module": "es2020", 15 | "lib": [ 16 | "es2018", 17 | "dom" 18 | ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rulesDirectory": [ 4 | "codelyzer" 5 | ], 6 | "rules": { 7 | "align": { 8 | "options": [ 9 | "parameters", 10 | "statements" 11 | ] 12 | }, 13 | "array-type": false, 14 | "arrow-return-shorthand": true, 15 | "curly": true, 16 | "deprecation": { 17 | "severity": "warning" 18 | }, 19 | "eofline": true, 20 | "import-blacklist": [ 21 | true, 22 | "rxjs/Rx" 23 | ], 24 | "import-spacing": true, 25 | "indent": { 26 | "options": [ 27 | "spaces" 28 | ] 29 | }, 30 | "max-classes-per-file": false, 31 | "max-line-length": [ 32 | true, 33 | 140 34 | ], 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-console": [ 47 | true, 48 | "debug", 49 | "info", 50 | "time", 51 | "timeEnd", 52 | "trace" 53 | ], 54 | "no-empty": false, 55 | "no-inferrable-types": [ 56 | true, 57 | "ignore-params" 58 | ], 59 | "no-non-null-assertion": true, 60 | "no-redundant-jsdoc": true, 61 | "no-switch-case-fall-through": true, 62 | "no-var-requires": false, 63 | "object-literal-key-quotes": [ 64 | true, 65 | "as-needed" 66 | ], 67 | "quotemark": [ 68 | true, 69 | "single" 70 | ], 71 | "semicolon": { 72 | "options": [ 73 | "always" 74 | ] 75 | }, 76 | "space-before-function-paren": { 77 | "options": { 78 | "anonymous": "never", 79 | "asyncArrow": "always", 80 | "constructor": "never", 81 | "method": "never", 82 | "named": "never" 83 | } 84 | }, 85 | "typedef": [ 86 | true, 87 | "call-signature" 88 | ], 89 | "typedef-whitespace": { 90 | "options": [ 91 | { 92 | "call-signature": "nospace", 93 | "index-signature": "nospace", 94 | "parameter": "nospace", 95 | "property-declaration": "nospace", 96 | "variable-declaration": "nospace" 97 | }, 98 | { 99 | "call-signature": "onespace", 100 | "index-signature": "onespace", 101 | "parameter": "onespace", 102 | "property-declaration": "onespace", 103 | "variable-declaration": "onespace" 104 | } 105 | ] 106 | }, 107 | "variable-name": { 108 | "options": [ 109 | "ban-keywords", 110 | "check-format", 111 | "allow-pascal-case" 112 | ] 113 | }, 114 | "whitespace": { 115 | "options": [ 116 | "check-branch", 117 | "check-decl", 118 | "check-operator", 119 | "check-separator", 120 | "check-type", 121 | "check-typecast" 122 | ] 123 | }, 124 | "component-class-suffix": true, 125 | "contextual-lifecycle": true, 126 | "directive-class-suffix": true, 127 | "no-conflicting-lifecycle": true, 128 | "no-host-metadata-property": true, 129 | "no-input-rename": true, 130 | "no-inputs-metadata-property": true, 131 | "no-output-native": true, 132 | "no-output-on-prefix": true, 133 | "no-output-rename": true, 134 | "no-outputs-metadata-property": true, 135 | "template-banana-in-box": true, 136 | "template-no-negated-async": true, 137 | "use-lifecycle-interface": true, 138 | "use-pipe-transform-interface": true, 139 | "directive-selector": [ 140 | true, 141 | "attribute", 142 | "app", 143 | "camelCase" 144 | ], 145 | "component-selector": [ 146 | true, 147 | "element", 148 | "app", 149 | "kebab-case" 150 | ] 151 | } 152 | } 153 | --------------------------------------------------------------------------------