├── Angular 7 ├── .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 │ │ ├── app.component.css │ │ ├── app.component.html │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── employees │ │ │ ├── employee-list │ │ │ │ ├── employee-list.component.css │ │ │ │ ├── employee-list.component.html │ │ │ │ └── employee-list.component.ts │ │ │ ├── employee │ │ │ │ ├── employee.component.css │ │ │ │ ├── employee.component.html │ │ │ │ └── employee.component.ts │ │ │ ├── employees.component.css │ │ │ ├── employees.component.html │ │ │ └── employees.component.ts │ │ └── shared │ │ │ ├── employee.model.ts │ │ │ └── employee.service.ts │ ├── appStructure.txt │ ├── assets │ │ └── .gitkeep │ ├── browserslist │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── karma.conf.js │ ├── main.ts │ ├── polyfills.ts │ ├── styles.css │ ├── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ └── tslint.json ├── tsconfig.json └── tslint.json └── README.md /Angular 7/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://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 | -------------------------------------------------------------------------------- /Angular 7/.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 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | 20 | # IDE - VSCode 21 | .vscode/* 22 | !.vscode/settings.json 23 | !.vscode/tasks.json 24 | !.vscode/launch.json 25 | !.vscode/extensions.json 26 | 27 | # misc 28 | /.sass-cache 29 | /connect.lock 30 | /coverage 31 | /libpeerconnection.log 32 | npm-debug.log 33 | yarn-error.log 34 | testem.log 35 | /typings 36 | 37 | # System Files 38 | .DS_Store 39 | Thumbs.db 40 | -------------------------------------------------------------------------------- /Angular 7/README.md: -------------------------------------------------------------------------------- 1 | # Angular7Firestore 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.0.3. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 28 | -------------------------------------------------------------------------------- /Angular 7/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "Angular7Firestore": { 7 | "root": "", 8 | "sourceRoot": "src", 9 | "projectType": "application", 10 | "prefix": "app", 11 | "schematics": {}, 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:browser", 15 | "options": { 16 | "outputPath": "dist/Angular7Firestore", 17 | "index": "src/index.html", 18 | "main": "src/main.ts", 19 | "polyfills": "src/polyfills.ts", 20 | "tsConfig": "src/tsconfig.app.json", 21 | "assets": [ 22 | "src/favicon.ico", 23 | "src/assets" 24 | ], 25 | "styles": [ 26 | "src/styles.css", 27 | "node_modules/ngx-toastr/toastr.css" 28 | ], 29 | "scripts": [] 30 | }, 31 | "configurations": { 32 | "production": { 33 | "fileReplacements": [ 34 | { 35 | "replace": "src/environments/environment.ts", 36 | "with": "src/environments/environment.prod.ts" 37 | } 38 | ], 39 | "optimization": true, 40 | "outputHashing": "all", 41 | "sourceMap": false, 42 | "extractCss": true, 43 | "namedChunks": false, 44 | "aot": true, 45 | "extractLicenses": true, 46 | "vendorChunk": false, 47 | "buildOptimizer": true, 48 | "budgets": [ 49 | { 50 | "type": "initial", 51 | "maximumWarning": "2mb", 52 | "maximumError": "5mb" 53 | } 54 | ] 55 | } 56 | } 57 | }, 58 | "serve": { 59 | "builder": "@angular-devkit/build-angular:dev-server", 60 | "options": { 61 | "browserTarget": "Angular7Firestore:build" 62 | }, 63 | "configurations": { 64 | "production": { 65 | "browserTarget": "Angular7Firestore:build:production" 66 | } 67 | } 68 | }, 69 | "extract-i18n": { 70 | "builder": "@angular-devkit/build-angular:extract-i18n", 71 | "options": { 72 | "browserTarget": "Angular7Firestore:build" 73 | } 74 | }, 75 | "test": { 76 | "builder": "@angular-devkit/build-angular:karma", 77 | "options": { 78 | "main": "src/test.ts", 79 | "polyfills": "src/polyfills.ts", 80 | "tsConfig": "src/tsconfig.spec.json", 81 | "karmaConfig": "src/karma.conf.js", 82 | "styles": [ 83 | "src/styles.css" 84 | ], 85 | "scripts": [], 86 | "assets": [ 87 | "src/favicon.ico", 88 | "src/assets" 89 | ] 90 | } 91 | }, 92 | "lint": { 93 | "builder": "@angular-devkit/build-angular:tslint", 94 | "options": { 95 | "tsConfig": [ 96 | "src/tsconfig.app.json", 97 | "src/tsconfig.spec.json" 98 | ], 99 | "exclude": [ 100 | "**/node_modules/**" 101 | ] 102 | } 103 | } 104 | } 105 | }, 106 | "Angular7Firestore-e2e": { 107 | "root": "e2e/", 108 | "projectType": "application", 109 | "prefix": "", 110 | "architect": { 111 | "e2e": { 112 | "builder": "@angular-devkit/build-angular:protractor", 113 | "options": { 114 | "protractorConfig": "e2e/protractor.conf.js", 115 | "devServerTarget": "Angular7Firestore:serve" 116 | }, 117 | "configurations": { 118 | "production": { 119 | "devServerTarget": "Angular7Firestore:serve:production" 120 | } 121 | } 122 | }, 123 | "lint": { 124 | "builder": "@angular-devkit/build-angular:tslint", 125 | "options": { 126 | "tsConfig": "e2e/tsconfig.e2e.json", 127 | "exclude": [ 128 | "**/node_modules/**" 129 | ] 130 | } 131 | } 132 | } 133 | } 134 | }, 135 | "defaultProject": "Angular7Firestore" 136 | } -------------------------------------------------------------------------------- /Angular 7/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 | }; -------------------------------------------------------------------------------- /Angular 7/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.getParagraphText()).toEqual('Welcome to Angular7Firestore!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /Angular 7/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 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Angular 7/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 | } -------------------------------------------------------------------------------- /Angular 7/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular7-firestore", 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.0.0", 15 | "@angular/common": "~7.0.0", 16 | "@angular/compiler": "~7.0.0", 17 | "@angular/core": "~7.0.0", 18 | "@angular/fire": "^5.1.0", 19 | "@angular/forms": "~7.0.0", 20 | "@angular/http": "~7.0.0", 21 | "@angular/platform-browser": "~7.0.0", 22 | "@angular/platform-browser-dynamic": "~7.0.0", 23 | "@angular/router": "~7.0.0", 24 | "core-js": "^2.5.4", 25 | "firebase": "^5.5.7", 26 | "ngx-toastr": "^9.1.1", 27 | "rxjs": "~6.3.3", 28 | "zone.js": "~0.8.26" 29 | }, 30 | "devDependencies": { 31 | "@angular-devkit/build-angular": "~0.10.0", 32 | "@angular/cli": "~7.0.3", 33 | "@angular/compiler-cli": "~7.0.0", 34 | "@angular/language-service": "~7.0.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.0.0", 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.1.1" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Angular 7/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Angular-7-CRUD-with-Firestore/1b7f0bdb3b7d73d539a4c1d6c8edd6fa74940068/Angular 7/src/app/app.component.css -------------------------------------------------------------------------------- /Angular 7/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
-------------------------------------------------------------------------------- /Angular 7/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.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'Angular7Firestore'; 10 | } 11 | -------------------------------------------------------------------------------- /Angular 7/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | import { AngularFireModule } from "@angular/fire"; 4 | import { AngularFirestoreModule } from "@angular/fire/firestore"; 5 | import { FormsModule } from "@angular/forms"; 6 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 7 | 8 | import { ToastrModule } from 'ngx-toastr'; 9 | import { AppComponent } from './app.component'; 10 | import { environment } from 'src/environments/environment'; 11 | import { EmployeesComponent } from './employees/employees.component'; 12 | import { EmployeeComponent } from './employees/employee/employee.component'; 13 | import { EmployeeListComponent } from './employees/employee-list/employee-list.component'; 14 | import { EmployeeService } from './shared/employee.service'; 15 | 16 | @NgModule({ 17 | declarations: [ 18 | AppComponent, 19 | EmployeesComponent, 20 | EmployeeComponent, 21 | EmployeeListComponent 22 | ], 23 | imports: [ 24 | BrowserModule, 25 | AngularFireModule.initializeApp(environment.firebaseConfig), 26 | AngularFirestoreModule, 27 | FormsModule, 28 | BrowserAnimationsModule, 29 | ToastrModule.forRoot() 30 | ], 31 | providers: [EmployeeService], 32 | bootstrap: [AppComponent] 33 | }) 34 | export class AppModule { } 35 | -------------------------------------------------------------------------------- /Angular 7/src/app/employees/employee-list/employee-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Angular-7-CRUD-with-Firestore/1b7f0bdb3b7d73d539a4c1d6c8edd6fa74940068/Angular 7/src/app/employees/employee-list/employee-list.component.css -------------------------------------------------------------------------------- /Angular 7/src/app/employees/employee-list/employee-list.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
NamePositionMobile
{{emp.empCode}} - {{emp.fullName}}{{emp.position}}{{emp.mobile}}
-------------------------------------------------------------------------------- /Angular 7/src/app/employees/employee-list/employee-list.component.ts: -------------------------------------------------------------------------------- 1 | import { AngularFirestore } from '@angular/fire/firestore'; 2 | import { Component, OnInit } from '@angular/core'; 3 | import { EmployeeService } from 'src/app/shared/employee.service'; 4 | import { Employee } from 'src/app/shared/employee.model'; 5 | import { ToastrService } from 'ngx-toastr'; 6 | 7 | @Component({ 8 | selector: 'app-employee-list', 9 | templateUrl: './employee-list.component.html', 10 | styleUrls: ['./employee-list.component.css'] 11 | }) 12 | export class EmployeeListComponent implements OnInit { 13 | 14 | list: Employee[]; 15 | constructor(private service: EmployeeService, 16 | private firestore: AngularFirestore, 17 | private toastr:ToastrService) { } 18 | 19 | ngOnInit() { 20 | this.service.getEmployees().subscribe(actionArray => { 21 | this.list = actionArray.map(item => { 22 | return { 23 | id: item.payload.doc.id, 24 | ...item.payload.doc.data() 25 | } as Employee; 26 | }) 27 | }); 28 | } 29 | 30 | onEdit(emp: Employee) { 31 | this.service.formData = Object.assign({}, emp); 32 | } 33 | 34 | onDelete(id: string) { 35 | if (confirm("Are you sure to delete this record?")) { 36 | this.firestore.doc('employees/' + id).delete(); 37 | this.toastr.warning('Deleted successfully','EMP. Register'); 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /Angular 7/src/app/employees/employee/employee.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Angular-7-CRUD-with-Firestore/1b7f0bdb3b7d73d539a4c1d6c8edd6fa74940068/Angular 7/src/app/employees/employee/employee.component.css -------------------------------------------------------------------------------- /Angular 7/src/app/employees/employee/employee.component.html: -------------------------------------------------------------------------------- 1 |

EMP. Register

2 |
3 | 4 |
5 | 6 |
This field is required.
7 |
8 |
9 | 10 |
11 |
12 |
13 | 14 |
15 |
16 | 17 |
18 |
19 |
20 | 21 |
22 | 23 |
-------------------------------------------------------------------------------- /Angular 7/src/app/employees/employee/employee.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { EmployeeService } from 'src/app/shared/employee.service'; 3 | import { NgForm } from '@angular/forms'; 4 | import { AngularFirestore } from '@angular/fire/firestore'; 5 | import { ToastrService } from 'ngx-toastr'; 6 | 7 | @Component({ 8 | selector: 'app-employee', 9 | templateUrl: './employee.component.html', 10 | styleUrls: ['./employee.component.css'] 11 | }) 12 | export class EmployeeComponent implements OnInit { 13 | 14 | constructor(private service: EmployeeService, 15 | private firestore: AngularFirestore, 16 | private toastr: ToastrService) { } 17 | 18 | ngOnInit() { 19 | this.resetForm(); 20 | } 21 | 22 | resetForm(form?: NgForm) { 23 | if (form != null) 24 | form.resetForm(); 25 | this.service.formData = { 26 | id: null, 27 | fullName: '', 28 | position: '', 29 | empCode: '', 30 | mobile: '', 31 | } 32 | } 33 | 34 | onSubmit(form: NgForm) { 35 | let data = Object.assign({}, form.value); 36 | delete data.id; 37 | if (form.value.id == null) 38 | this.firestore.collection('employees').add(data); 39 | else 40 | this.firestore.doc('employees/' + form.value.id).update(data); 41 | this.resetForm(form); 42 | this.toastr.success('Submitted successfully', 'EMP. Register'); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /Angular 7/src/app/employees/employees.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Angular-7-CRUD-with-Firestore/1b7f0bdb3b7d73d539a4c1d6c8edd6fa74940068/Angular 7/src/app/employees/employees.component.css -------------------------------------------------------------------------------- /Angular 7/src/app/employees/employees.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
6 | 7 |
8 |
-------------------------------------------------------------------------------- /Angular 7/src/app/employees/employees.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-employees', 5 | templateUrl: './employees.component.html', 6 | styleUrls: ['./employees.component.css'] 7 | }) 8 | export class EmployeesComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Angular 7/src/app/shared/employee.model.ts: -------------------------------------------------------------------------------- 1 | export class Employee { 2 | id: string; 3 | fullName: string; 4 | empCode: string; 5 | position: string; 6 | mobile: string; 7 | } 8 | -------------------------------------------------------------------------------- /Angular 7/src/app/shared/employee.service.ts: -------------------------------------------------------------------------------- 1 | import { AngularFirestore } from '@angular/fire/firestore'; 2 | import { Injectable } from '@angular/core'; 3 | import { Employee } from './employee.model'; 4 | 5 | @Injectable({ 6 | providedIn: 'root' 7 | }) 8 | export class EmployeeService { 9 | formData: Employee; 10 | 11 | constructor(private firestore: AngularFirestore) { } 12 | 13 | getEmployees() { 14 | return this.firestore.collection('employees').snapshotChanges(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Angular 7/src/appStructure.txt: -------------------------------------------------------------------------------- 1 | ● src 2 | +---● app 3 | | +--● employees 4 | | | |--employees.component.ts|.html|.css 5 | | | +--● employee 6 | | | | |--employee.component.ts|.html|.css 7 | | | | 8 | | | +--● employee-list 9 | | | | |--employee-list.component.ts|.html|.css 10 | | | | 11 | | | +--● shared 12 | | | |--employee.service.ts 13 | | | |--employee.model.ts 14 | | | 15 | | |--app.module.ts (configured firebase connection) 16 | | 17 | +---● environments 18 | | |--environment.ts (saved firebase connection details) 19 | | 20 | |--index.html (cdn path for bootstrap and font awesome icon) -------------------------------------------------------------------------------- /Angular 7/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Angular-7-CRUD-with-Firestore/1b7f0bdb3b7d73d539a4c1d6c8edd6fa74940068/Angular 7/src/assets/.gitkeep -------------------------------------------------------------------------------- /Angular 7/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 -------------------------------------------------------------------------------- /Angular 7/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /Angular 7/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 | firebaseConfig : { 8 | apiKey: "AIzaSyBgHu5nUzmDbrnNDmjpCOfctLFTD3iW9FU", 9 | authDomain: "firestorecrud-4f122.firebaseapp.com", 10 | databaseURL: "https://firestorecrud-4f122.firebaseio.com", 11 | projectId: "firestorecrud-4f122", 12 | storageBucket: "firestorecrud-4f122.appspot.com", 13 | messagingSenderId: "421200318388" 14 | } 15 | }; 16 | 17 | /* 18 | * For easier debugging in development mode, you can import the following file 19 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 20 | * 21 | * This import should be commented out in production mode because it will have a negative impact 22 | * on performance if an error is thrown. 23 | */ 24 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 25 | -------------------------------------------------------------------------------- /Angular 7/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Angular-7-CRUD-with-Firestore/1b7f0bdb3b7d73d539a4c1d6c8edd6fa74940068/Angular 7/src/favicon.ico -------------------------------------------------------------------------------- /Angular 7/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Angular7Firestore 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Angular 7/src/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../coverage'), 20 | reports: ['html', 'lcovonly'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false 30 | }); 31 | }; -------------------------------------------------------------------------------- /Angular 7/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 | -------------------------------------------------------------------------------- /Angular 7/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 and IE11 requires all of the following polyfills. **/ 22 | // import 'core-js/es6/symbol'; 23 | // import 'core-js/es6/object'; 24 | // import 'core-js/es6/function'; 25 | // import 'core-js/es6/parse-int'; 26 | // import 'core-js/es6/parse-float'; 27 | // import 'core-js/es6/number'; 28 | // import 'core-js/es6/math'; 29 | // import 'core-js/es6/string'; 30 | // import 'core-js/es6/date'; 31 | // import 'core-js/es6/array'; 32 | // import 'core-js/es6/regexp'; 33 | // import 'core-js/es6/map'; 34 | // import 'core-js/es6/weak-map'; 35 | // import 'core-js/es6/set'; 36 | 37 | /** 38 | * If the application will be indexed by Google Search, the following is required. 39 | * Googlebot uses a renderer based on Chrome 41. 40 | * https://developers.google.com/search/docs/guides/rendering 41 | **/ 42 | // import 'core-js/es6/array'; 43 | 44 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 45 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 46 | 47 | /** IE10 and IE11 requires the following for the Reflect API. */ 48 | // import 'core-js/es6/reflect'; 49 | 50 | /** 51 | * Web Animations `@angular/platform-browser/animations` 52 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 53 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 54 | **/ 55 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 56 | 57 | /** 58 | * By default, zone.js will patch all possible macroTask and DomEvents 59 | * user can disable parts of macroTask/DomEvents patch by setting following flags 60 | */ 61 | 62 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 63 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 64 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 65 | 66 | /* 67 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 68 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 69 | */ 70 | // (window as any).__Zone_enable_cross_context_check = true; 71 | 72 | /*************************************************************************************************** 73 | * Zone JS is required by default for Angular itself. 74 | */ 75 | import 'zone.js/dist/zone'; // Included with Angular CLI. 76 | 77 | 78 | /*************************************************************************************************** 79 | * APPLICATION IMPORTS 80 | */ 81 | -------------------------------------------------------------------------------- /Angular 7/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | 3 | input.ng-touched.ng-invalid{ 4 | border-color: #dc3545; 5 | } 6 | 7 | div.validation-error{ 8 | width: 100%; 9 | margin-top: .25rem; 10 | font-size: 80%; 11 | color: #dc3545; 12 | } 13 | 14 | table.table-hover tbody tr:hover{ 15 | cursor: pointer; 16 | } -------------------------------------------------------------------------------- /Angular 7/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 | -------------------------------------------------------------------------------- /Angular 7/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 | -------------------------------------------------------------------------------- /Angular 7/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 | -------------------------------------------------------------------------------- /Angular 7/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 | -------------------------------------------------------------------------------- /Angular 7/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 | "target": "es5", 13 | "typeRoots": [ 14 | "node_modules/@types" 15 | ], 16 | "lib": [ 17 | "es2018", 18 | "dom" 19 | ] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Angular 7/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": true, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-blacklist": [ 20 | true, 21 | "rxjs/Rx" 22 | ], 23 | "import-spacing": true, 24 | "indent": [ 25 | true, 26 | "spaces" 27 | ], 28 | "interface-over-type-literal": true, 29 | "label-position": true, 30 | "max-line-length": [ 31 | true, 32 | 140 33 | ], 34 | "member-access": false, 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-arg": true, 47 | "no-bitwise": true, 48 | "no-console": [ 49 | true, 50 | "debug", 51 | "info", 52 | "time", 53 | "timeEnd", 54 | "trace" 55 | ], 56 | "no-construct": true, 57 | "no-debugger": true, 58 | "no-duplicate-super": true, 59 | "no-empty": false, 60 | "no-empty-interface": true, 61 | "no-eval": true, 62 | "no-inferrable-types": [ 63 | true, 64 | "ignore-params" 65 | ], 66 | "no-misused-new": true, 67 | "no-non-null-assertion": true, 68 | "no-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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Angular-7-CRUD-with-Firestore 2 | Angular 7 CRUD with Firestore - Insert Update and Delete Using Firebase Project. 3 | 4 | ## Get the Code 5 | 6 | ``` 7 | $ git clone https://github.com/CodAffection/Angular-7-CRUD-with-Firestore.git 8 | $ cd Angular-7-CRUD-with-Firestore/Angular 7 9 | $ npm install 10 | //run the app 11 | $ ng serve 12 | //Configure firebase project with your gmail account. 13 | ``` 14 | 15 | ## How it works ? 16 | 17 | :scroll: Article on this topic 18 | Url : https://goo.gl/vafSt2 19 | 20 | :tv: Video tutorial on this same topic 21 | Url : https://youtu.be/5I6k77uqtLY 22 | 23 | Video Tutorial for Angular 7 CRUD with Firestore 26 | 27 | 28 | | :bar_chart: | List of Tutorials | | :moneybag: | Support Us | 29 | |--------------------------:|:---------------------|---|---------------------:|:-------------------------------------| 30 | | Angular |http://bit.ly/2KQN9xF | |Paypal | https://goo.gl/bPcyXW | 31 | | Asp.Net Core |http://bit.ly/30fPDMg | |Amazon Affiliate | https://geni.us/JDzpE | 32 | | React |http://bit.ly/325temF | | 33 | | Python |http://bit.ly/2ws4utg | | :point_right: | Follow Us | 34 | | Node.js |https://goo.gl/viJcFs | |Website |http://www.codaffection.com | 35 | | Asp.Net MVC |https://goo.gl/gvjUJ7 | |YouTube |https://www.youtube.com/codaffection | 36 | | Flutter |https://bit.ly/3ggmmJz| |Facebook |https://www.facebook.com/codaffection | 37 | | Web API |https://goo.gl/itVayJ | |Twitter |https://twitter.com/CodAffection | 38 | | MEAN Stack |https://goo.gl/YJPPAH | | 39 | | C# Tutorial |https://goo.gl/s1zJxo | | 40 | | Asp.Net WebForm |https://goo.gl/GXC2aJ | | 41 | | C# WinForm |https://goo.gl/vHS9Hd | | 42 | | MS SQL |https://goo.gl/MLYS9e | | 43 | | Crystal Report |https://goo.gl/5Vou7t | | 44 | | CG Exercises in C Program |https://goo.gl/qEWJCs | | 45 | 46 | --------------------------------------------------------------------------------