├── CompleteAngularMaterialApp ├── .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.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── employees │ │ │ ├── employee-list │ │ │ │ ├── employee-list.component.css │ │ │ │ ├── employee-list.component.html │ │ │ │ ├── employee-list.component.spec.ts │ │ │ │ └── employee-list.component.ts │ │ │ ├── employee │ │ │ │ ├── employee.component.css │ │ │ │ ├── employee.component.html │ │ │ │ ├── employee.component.spec.ts │ │ │ │ └── employee.component.ts │ │ │ ├── employees.component.css │ │ │ ├── employees.component.html │ │ │ ├── employees.component.spec.ts │ │ │ └── employees.component.ts │ │ ├── mat-confirm-dialog │ │ │ ├── mat-confirm-dialog.component.css │ │ │ ├── mat-confirm-dialog.component.html │ │ │ ├── mat-confirm-dialog.component.spec.ts │ │ │ └── mat-confirm-dialog.component.ts │ │ ├── material │ │ │ ├── material.module.spec.ts │ │ │ └── material.module.ts │ │ └── shared │ │ │ ├── department.service.ts │ │ │ ├── dialog.service.ts │ │ │ ├── employee.service.ts │ │ │ └── notification.service.ts │ ├── 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 /CompleteAngularMaterialApp/.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 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/.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 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/README.md: -------------------------------------------------------------------------------- 1 | # CompleteAngularMaterialApp 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.0. 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 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "CompleteAngularMaterialApp": { 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/CompleteAngularMaterialApp", 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 | ], 28 | "scripts": [] 29 | }, 30 | "configurations": { 31 | "production": { 32 | "fileReplacements": [ 33 | { 34 | "replace": "src/environments/environment.ts", 35 | "with": "src/environments/environment.prod.ts" 36 | } 37 | ], 38 | "optimization": true, 39 | "outputHashing": "all", 40 | "sourceMap": false, 41 | "extractCss": true, 42 | "namedChunks": false, 43 | "aot": true, 44 | "extractLicenses": true, 45 | "vendorChunk": false, 46 | "buildOptimizer": true 47 | } 48 | } 49 | }, 50 | "serve": { 51 | "builder": "@angular-devkit/build-angular:dev-server", 52 | "options": { 53 | "browserTarget": "CompleteAngularMaterialApp:build" 54 | }, 55 | "configurations": { 56 | "production": { 57 | "browserTarget": "CompleteAngularMaterialApp:build:production" 58 | } 59 | } 60 | }, 61 | "extract-i18n": { 62 | "builder": "@angular-devkit/build-angular:extract-i18n", 63 | "options": { 64 | "browserTarget": "CompleteAngularMaterialApp:build" 65 | } 66 | }, 67 | "test": { 68 | "builder": "@angular-devkit/build-angular:karma", 69 | "options": { 70 | "main": "src/test.ts", 71 | "polyfills": "src/polyfills.ts", 72 | "tsConfig": "src/tsconfig.spec.json", 73 | "karmaConfig": "src/karma.conf.js", 74 | "styles": [ 75 | "styles.css" 76 | ], 77 | "scripts": [], 78 | "assets": [ 79 | "src/favicon.ico", 80 | "src/assets" 81 | ] 82 | } 83 | }, 84 | "lint": { 85 | "builder": "@angular-devkit/build-angular:tslint", 86 | "options": { 87 | "tsConfig": [ 88 | "src/tsconfig.app.json", 89 | "src/tsconfig.spec.json" 90 | ], 91 | "exclude": [ 92 | "**/node_modules/**" 93 | ] 94 | } 95 | } 96 | } 97 | }, 98 | "CompleteAngularMaterialApp-e2e": { 99 | "root": "e2e/", 100 | "projectType": "application", 101 | "architect": { 102 | "e2e": { 103 | "builder": "@angular-devkit/build-angular:protractor", 104 | "options": { 105 | "protractorConfig": "e2e/protractor.conf.js", 106 | "devServerTarget": "CompleteAngularMaterialApp:serve" 107 | } 108 | }, 109 | "lint": { 110 | "builder": "@angular-devkit/build-angular:tslint", 111 | "options": { 112 | "tsConfig": "e2e/tsconfig.e2e.json", 113 | "exclude": [ 114 | "**/node_modules/**" 115 | ] 116 | } 117 | } 118 | } 119 | } 120 | }, 121 | "defaultProject": "CompleteAngularMaterialApp" 122 | } -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/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 | }; -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/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 app!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/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 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/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 | } -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "complete-angular-material-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": "^6.1.6", 15 | "@angular/cdk": "^6.4.7", 16 | "@angular/common": "^6.0.0", 17 | "@angular/compiler": "^6.0.0", 18 | "@angular/core": "^6.0.0", 19 | "@angular/forms": "^6.0.0", 20 | "@angular/http": "^6.0.0", 21 | "@angular/material": "^6.4.7", 22 | "@angular/platform-browser": "^6.0.0", 23 | "@angular/platform-browser-dynamic": "^6.0.0", 24 | "@angular/router": "^6.0.0", 25 | "angularfire2": "^5.0.0-rc.12", 26 | "core-js": "^2.5.4", 27 | "firebase": "^5.4.2", 28 | "lodash": "^4.17.11", 29 | "rxjs": "^6.0.0", 30 | "zone.js": "^0.8.26" 31 | }, 32 | "devDependencies": { 33 | "@angular/compiler-cli": "^6.0.0", 34 | "@angular-devkit/build-angular": "~0.6.0", 35 | "typescript": "~2.7.2", 36 | "@angular/cli": "~6.0.0", 37 | "@angular/language-service": "^6.0.0", 38 | "@types/jasmine": "~2.8.6", 39 | "@types/jasminewd2": "~2.0.3", 40 | "@types/node": "~8.9.4", 41 | "codelyzer": "~4.2.1", 42 | "jasmine-core": "~2.99.1", 43 | "jasmine-spec-reporter": "~4.2.1", 44 | "karma": "~1.7.1", 45 | "karma-chrome-launcher": "~2.2.0", 46 | "karma-coverage-istanbul-reporter": "~1.4.2", 47 | "karma-jasmine": "~1.1.1", 48 | "karma-jasmine-html-reporter": "^0.2.2", 49 | "protractor": "~5.3.0", 50 | "ts-node": "~5.0.1", 51 | "tslint": "~5.9.1" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Angular-Material-Confirm-Dialog/283906e0eb50090f9e418d478077904a726b4c59/CompleteAngularMaterialApp/src/app/app.component.css -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | describe('AppComponent', () => { 4 | beforeEach(async(() => { 5 | TestBed.configureTestingModule({ 6 | declarations: [ 7 | AppComponent 8 | ], 9 | }).compileComponents(); 10 | })); 11 | it('should create the app', async(() => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.debugElement.componentInstance; 14 | expect(app).toBeTruthy(); 15 | })); 16 | it(`should have as title 'app'`, async(() => { 17 | const fixture = TestBed.createComponent(AppComponent); 18 | const app = fixture.debugElement.componentInstance; 19 | expect(app.title).toEqual('app'); 20 | })); 21 | it('should render title in a h1 tag', async(() => { 22 | const fixture = TestBed.createComponent(AppComponent); 23 | fixture.detectChanges(); 24 | const compiled = fixture.debugElement.nativeElement; 25 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!'); 26 | })); 27 | }); 28 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/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 = 'app'; 10 | } 11 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | import { MaterialModule } from "./material/material.module"; 4 | import { ReactiveFormsModule,FormsModule } from "@angular/forms"; 5 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 6 | import { AngularFireModule } from 'angularfire2'; 7 | import { AngularFireDatabaseModule } from 'angularfire2/database'; 8 | import { DatePipe } from '@angular/common'; 9 | 10 | import { AppComponent } from './app.component'; 11 | import { EmployeesComponent } from './employees/employees.component'; 12 | import { EmployeeComponent } from './employees/employee/employee.component'; 13 | import { EmployeeService } from './shared/employee.service'; 14 | import { environment } from '../environments/environment'; 15 | import { DepartmentService } from './shared/department.service'; 16 | import { EmployeeListComponent } from './employees/employee-list/employee-list.component'; 17 | import { MatConfirmDialogComponent } from './mat-confirm-dialog/mat-confirm-dialog.component'; 18 | 19 | @NgModule({ 20 | declarations: [ 21 | AppComponent, 22 | EmployeesComponent, 23 | EmployeeComponent, 24 | EmployeeListComponent, 25 | MatConfirmDialogComponent 26 | ], 27 | imports: [ 28 | BrowserModule, 29 | MaterialModule, 30 | ReactiveFormsModule, 31 | BrowserAnimationsModule, 32 | AngularFireDatabaseModule, 33 | AngularFireModule.initializeApp(environment.firebaseConfig), 34 | FormsModule 35 | ], 36 | providers: [EmployeeService,DepartmentService,DatePipe], 37 | bootstrap: [AppComponent], 38 | entryComponents:[EmployeeComponent,MatConfirmDialogComponent] 39 | }) 40 | export class AppModule { } 41 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/employees/employee-list/employee-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Angular-Material-Confirm-Dialog/283906e0eb50090f9e418d478077904a726b4c59/CompleteAngularMaterialApp/src/app/employees/employee-list/employee-list.component.css -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/employees/employee-list/employee-list.component.html: -------------------------------------------------------------------------------- 1 |
2 | 5 | 6 | 7 | 10 | 11 |
12 |
13 | 14 | 15 | Full Name 16 | {{element.fullName}} 17 | 18 | 19 | Email 20 | {{element.email}} 21 | 22 | 23 | Mobile 24 | {{element.mobile}} 25 | 26 | 27 | City 28 | {{element.city}} 29 | 30 | 31 | Department 32 | {{element.departmentName}} 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | Loading data... 44 | 45 | 46 | 47 | 48 | No data. 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
-------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/employees/employee-list/employee-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { EmployeeListComponent } from './employee-list.component'; 4 | 5 | describe('EmployeeListComponent', () => { 6 | let component: EmployeeListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ EmployeeListComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(EmployeeListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/employees/employee-list/employee-list.component.ts: -------------------------------------------------------------------------------- 1 | import { EmployeeComponent } from './../employee/employee.component'; 2 | import { Component, OnInit, ViewChild } from '@angular/core'; 3 | import { EmployeeService } from '../../shared/employee.service'; 4 | import { MatTableDataSource, MatSort, MatPaginator } from '@angular/material'; 5 | import { DepartmentService } from '../../shared/department.service'; 6 | import { MatDialog, MatDialogConfig } from "@angular/material"; 7 | import { NotificationService } from '../../shared/notification.service'; 8 | import { DialogService } from '../../shared/dialog.service'; 9 | 10 | @Component({ 11 | selector: 'app-employee-list', 12 | templateUrl: './employee-list.component.html', 13 | styleUrls: ['./employee-list.component.css'] 14 | }) 15 | export class EmployeeListComponent implements OnInit { 16 | 17 | constructor(private service: EmployeeService, 18 | private departmentService: DepartmentService, 19 | private dialog: MatDialog, 20 | private notificationService: NotificationService, 21 | private dialogService: DialogService) { } 22 | 23 | listData: MatTableDataSource; 24 | displayedColumns: string[] = ['fullName', 'email', 'mobile', 'city', 'departmentName', 'actions']; 25 | @ViewChild(MatSort) sort: MatSort; 26 | @ViewChild(MatPaginator) paginator: MatPaginator; 27 | searchKey: string; 28 | 29 | ngOnInit() { 30 | this.service.getEmployees().subscribe( 31 | list => { 32 | let array = list.map(item => { 33 | let departmentName = this.departmentService.getDepartmentName(item.payload.val()['department']); 34 | return { 35 | $key: item.key, 36 | departmentName, 37 | ...item.payload.val() 38 | }; 39 | }); 40 | this.listData = new MatTableDataSource(array); 41 | this.listData.sort = this.sort; 42 | this.listData.paginator = this.paginator; 43 | this.listData.filterPredicate = (data, filter) => { 44 | return this.displayedColumns.some(ele => { 45 | return ele != 'actions' && data[ele].toLowerCase().indexOf(filter) != -1; 46 | }); 47 | }; 48 | }); 49 | } 50 | 51 | onSearchClear() { 52 | this.searchKey = ""; 53 | this.applyFilter(); 54 | } 55 | 56 | applyFilter() { 57 | this.listData.filter = this.searchKey.trim().toLowerCase(); 58 | } 59 | 60 | 61 | onCreate() { 62 | this.service.initializeFormGroup(); 63 | const dialogConfig = new MatDialogConfig(); 64 | dialogConfig.disableClose = true; 65 | dialogConfig.autoFocus = true; 66 | dialogConfig.width = "60%"; 67 | this.dialog.open(EmployeeComponent,dialogConfig); 68 | } 69 | 70 | onEdit(row){ 71 | this.service.populateForm(row); 72 | const dialogConfig = new MatDialogConfig(); 73 | dialogConfig.disableClose = true; 74 | dialogConfig.autoFocus = true; 75 | dialogConfig.width = "60%"; 76 | this.dialog.open(EmployeeComponent,dialogConfig); 77 | } 78 | 79 | onDelete($key){ 80 | this.dialogService.openConfirmDialog('Are you sure to delete this record ?') 81 | .afterClosed().subscribe(res =>{ 82 | if(res){ 83 | this.service.deleteEmployee($key); 84 | this.notificationService.warn('! Deleted successfully'); 85 | } 86 | }); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/employees/employee/employee.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Angular-Material-Confirm-Dialog/283906e0eb50090f9e418d478077904a726b4c59/CompleteAngularMaterialApp/src/app/employees/employee/employee.component.css -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/employees/employee/employee.component.html: -------------------------------------------------------------------------------- 1 | 2 | {{service.form.controls['$key'].value?"Modify Employee":"New Employee"}} 3 | 4 | 5 | 6 |
7 | 8 | 9 |
10 | 11 | 12 | 13 | This field is mandatory. 14 | 15 | 16 | 17 | Invalid email address. 18 | 19 | 20 | 21 | This field is mandatory. 22 | Minimum 8 charactors needed. 23 | 24 | 25 | 26 | 27 |
28 |
29 | 30 |
31 |
32 | 33 | Male 34 | Female 35 | Other 36 | 37 |
38 | 39 | 40 | None 41 | 42 | {{department.code}}-{{department.name}} 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 |
52 | Permanent Employee 53 |
54 |
55 | 56 | 57 |
58 |
59 |
60 |
61 |
-------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/employees/employee/employee.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { EmployeeComponent } from './employee.component'; 4 | 5 | describe('EmployeeComponent', () => { 6 | let component: EmployeeComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ EmployeeComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(EmployeeComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/employees/employee/employee.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { MatDialogRef } from '@angular/material'; 3 | 4 | import { EmployeeService } from '../../shared/employee.service'; 5 | import { DepartmentService } from '../../shared/department.service'; 6 | import { NotificationService } from '../../shared/notification.service'; 7 | 8 | @Component({ 9 | selector: 'app-employee', 10 | templateUrl: './employee.component.html', 11 | styleUrls: ['./employee.component.css'] 12 | }) 13 | export class EmployeeComponent implements OnInit { 14 | 15 | constructor(private service: EmployeeService, 16 | private departmentService: DepartmentService, 17 | private notificationService: NotificationService, 18 | public dialogRef: MatDialogRef) { } 19 | 20 | 21 | 22 | ngOnInit() { 23 | this.service.getEmployees(); 24 | } 25 | 26 | onClear() { 27 | this.service.form.reset(); 28 | this.service.initializeFormGroup(); 29 | this.notificationService.success(':: Submitted successfully'); 30 | } 31 | 32 | onSubmit() { 33 | if (this.service.form.valid) { 34 | if (!this.service.form.get('$key').value) 35 | this.service.insertEmployee(this.service.form.value); 36 | else 37 | this.service.updateEmployee(this.service.form.value); 38 | this.service.form.reset(); 39 | this.service.initializeFormGroup(); 40 | this.notificationService.success(':: Submitted successfully'); 41 | this.onClose(); 42 | } 43 | } 44 | 45 | onClose() { 46 | this.service.form.reset(); 47 | this.service.initializeFormGroup(); 48 | this.dialogRef.close(); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/employees/employees.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Angular-Material-Confirm-Dialog/283906e0eb50090f9e418d478077904a726b4c59/CompleteAngularMaterialApp/src/app/employees/employees.component.css -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/employees/employees.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | Angular 6 Material 5 | 6 | 7 | 8 |
9 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/employees/employees.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { EmployeesComponent } from './employees.component'; 4 | 5 | describe('EmployeesComponent', () => { 6 | let component: EmployeesComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ EmployeesComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(EmployeesComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/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 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/mat-confirm-dialog/mat-confirm-dialog.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Angular-Material-Confirm-Dialog/283906e0eb50090f9e418d478077904a726b4c59/CompleteAngularMaterialApp/src/app/mat-confirm-dialog/mat-confirm-dialog.component.css -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/mat-confirm-dialog/mat-confirm-dialog.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | close 4 | {{data.message}} 5 |
6 | 7 | 8 |
9 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/mat-confirm-dialog/mat-confirm-dialog.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { MatConfirmDialogComponent } from './mat-confirm-dialog.component'; 4 | 5 | describe('MatConfirmDialogComponent', () => { 6 | let component: MatConfirmDialogComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ MatConfirmDialogComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(MatConfirmDialogComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/mat-confirm-dialog/mat-confirm-dialog.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Inject } from '@angular/core'; 2 | import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; 3 | 4 | @Component({ 5 | selector: 'app-mat-confirm-dialog', 6 | templateUrl: './mat-confirm-dialog.component.html', 7 | styleUrls: ['./mat-confirm-dialog.component.css'] 8 | }) 9 | export class MatConfirmDialogComponent implements OnInit { 10 | 11 | constructor(@Inject(MAT_DIALOG_DATA) public data, 12 | public dialogRef: MatDialogRef) { } 13 | 14 | ngOnInit() { 15 | } 16 | 17 | closeDialog() { 18 | this.dialogRef.close(false); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/material/material.module.spec.ts: -------------------------------------------------------------------------------- 1 | import { MaterialModule } from './material.module'; 2 | 3 | describe('MaterialModule', () => { 4 | let materialModule: MaterialModule; 5 | 6 | beforeEach(() => { 7 | materialModule = new MaterialModule(); 8 | }); 9 | 10 | it('should create an instance', () => { 11 | expect(materialModule).toBeTruthy(); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/material/material.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import * as Material from "@angular/material"; 4 | 5 | @NgModule({ 6 | imports: [ 7 | CommonModule, 8 | Material.MatToolbarModule, 9 | Material.MatGridListModule, 10 | Material.MatFormFieldModule, 11 | Material.MatInputModule, 12 | Material.MatRadioModule, 13 | Material.MatSelectModule, 14 | Material.MatCheckboxModule, 15 | Material.MatDatepickerModule, 16 | Material.MatNativeDateModule, 17 | Material.MatButtonModule, 18 | Material.MatSnackBarModule, 19 | Material.MatTableModule, 20 | Material.MatIconModule, 21 | Material.MatPaginatorModule, 22 | Material.MatSortModule, 23 | Material.MatDialogModule, 24 | 25 | ], 26 | exports: [ 27 | Material.MatToolbarModule, 28 | Material.MatGridListModule, 29 | Material.MatFormFieldModule, 30 | Material.MatInputModule, 31 | Material.MatRadioModule, 32 | Material.MatSelectModule, 33 | Material.MatCheckboxModule, 34 | Material.MatDatepickerModule, 35 | Material.MatNativeDateModule, 36 | Material.MatButtonModule, 37 | Material.MatSnackBarModule, 38 | Material.MatTableModule, 39 | Material.MatIconModule, 40 | Material.MatPaginatorModule, 41 | Material.MatSortModule, 42 | Material.MatDialogModule, 43 | 44 | ], 45 | declarations: [] 46 | }) 47 | export class MaterialModule { } 48 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/shared/department.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { AngularFireDatabase, AngularFireList } from 'angularfire2/database'; 3 | 4 | import * as _ from 'lodash'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | export class DepartmentService { 10 | departmentList: AngularFireList; 11 | array = []; 12 | 13 | constructor(private firebase: AngularFireDatabase) { 14 | this.departmentList = this.firebase.list('departments'); 15 | this.departmentList.snapshotChanges().subscribe( 16 | list => { 17 | this.array = list.map(item => { 18 | return { 19 | $key: item.key, 20 | ...item.payload.val() 21 | }; 22 | }); 23 | }); 24 | } 25 | 26 | 27 | getDepartmentName($key) { 28 | if ($key == "0") 29 | return ""; 30 | else{ 31 | return _.find(this.array, (obj) => { return obj.$key == $key; })['name']; 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/shared/dialog.service.ts: -------------------------------------------------------------------------------- 1 | import { MatConfirmDialogComponent } from './../mat-confirm-dialog/mat-confirm-dialog.component'; 2 | import { Injectable } from '@angular/core'; 3 | import { MatDialog } from '@angular/material'; 4 | 5 | @Injectable({ 6 | providedIn: 'root' 7 | }) 8 | export class DialogService { 9 | 10 | constructor(private dialog: MatDialog) { } 11 | 12 | openConfirmDialog(msg){ 13 | return this.dialog.open(MatConfirmDialogComponent,{ 14 | width: '390px', 15 | panelClass: 'confirm-dialog-container', 16 | disableClose: true, 17 | position: { top: "10px" }, 18 | data :{ 19 | message : msg 20 | } 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/shared/employee.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { FormGroup, FormControl, Validators } from "@angular/forms"; 3 | import { AngularFireDatabase, AngularFireList } from 'angularfire2/database'; 4 | import * as _ from 'lodash'; 5 | import { DatePipe } from '@angular/common'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class EmployeeService { 11 | 12 | constructor(private firebase: AngularFireDatabase, private datePipe: DatePipe) { } 13 | 14 | employeeList: AngularFireList; 15 | 16 | form: FormGroup = new FormGroup({ 17 | $key: new FormControl(null), 18 | fullName: new FormControl('', Validators.required), 19 | email: new FormControl('', Validators.email), 20 | mobile: new FormControl('', [Validators.required, Validators.minLength(8)]), 21 | city: new FormControl(''), 22 | gender: new FormControl('1'), 23 | department: new FormControl(0), 24 | hireDate: new FormControl(''), 25 | isPermanent: new FormControl(false) 26 | }); 27 | 28 | initializeFormGroup() { 29 | this.form.setValue({ 30 | $key: null, 31 | fullName: '', 32 | email: '', 33 | mobile: '', 34 | city: '', 35 | gender: '1', 36 | department: 0, 37 | hireDate: '', 38 | isPermanent: false 39 | }); 40 | } 41 | 42 | 43 | getEmployees() { 44 | this.employeeList = this.firebase.list('employees'); 45 | return this.employeeList.snapshotChanges(); 46 | } 47 | 48 | insertEmployee(employee) { 49 | this.employeeList.push({ 50 | fullName: employee.fullName, 51 | email: employee.email, 52 | mobile: employee.mobile, 53 | city: employee.city, 54 | gender: employee.gender, 55 | department: employee.department, 56 | hireDate: employee.hireDate == "" ? "" : this.datePipe.transform(employee.hireDate, 'yyyy-MM-dd'), 57 | isPermanent: employee.isPermanent 58 | }); 59 | } 60 | 61 | updateEmployee(employee) { 62 | this.employeeList.update(employee.$key, 63 | { 64 | fullName: employee.fullName, 65 | email: employee.email, 66 | mobile: employee.mobile, 67 | city: employee.city, 68 | gender: employee.gender, 69 | department: employee.department, 70 | hireDate: employee.hireDate == "" ? "" : this.datePipe.transform(employee.hireDate, 'yyyy-MM-dd'), 71 | isPermanent: employee.isPermanent 72 | }); 73 | } 74 | 75 | deleteEmployee($key: string) { 76 | this.employeeList.remove($key); 77 | } 78 | 79 | populateForm(employee) { 80 | this.form.setValue(_.omit(employee,'departmentName')); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/app/shared/notification.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { MatSnackBar, MatSnackBarConfig } from '@angular/material'; 3 | 4 | @Injectable({ 5 | providedIn: 'root' 6 | }) 7 | export class NotificationService { 8 | 9 | constructor(public snackBar: MatSnackBar) { } 10 | 11 | config: MatSnackBarConfig = { 12 | duration: 3000, 13 | horizontalPosition: 'right', 14 | verticalPosition: 'top' 15 | } 16 | 17 | 18 | success(msg) { 19 | this.config['panelClass'] = ['notification', 'success']; 20 | this.snackBar.open(msg, '',this.config); 21 | } 22 | 23 | warn(msg) { 24 | this.config['panelClass'] = ['notification', 'warn']; 25 | this.snackBar.open(msg, '', this.config); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Angular-Material-Confirm-Dialog/283906e0eb50090f9e418d478077904a726b4c59/CompleteAngularMaterialApp/src/assets/.gitkeep -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/browserslist: -------------------------------------------------------------------------------- 1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | # For IE 9-11 support, please uncomment the last line of the file and adjust as needed 5 | > 0.5% 6 | last 2 versions 7 | Firefox ESR 8 | not dead 9 | # IE 9-11 -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/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: "AIzaSyCrfwGPZUuO6IsLflLleiEPswDQeVC3mCI", 9 | authDomain: "amcrud.firebaseapp.com", 10 | databaseURL: "https://amcrud.firebaseio.com", 11 | projectId: "amcrud", 12 | storageBucket: "amcrud.appspot.com", 13 | messagingSenderId: "649950187891" 14 | } 15 | }; 16 | 17 | /* 18 | * In development mode, to ignore zone related error stack frames such as 19 | * `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can 20 | * import the following file, but please comment it out in production mode 21 | * because it will have performance impact when throw error 22 | */ 23 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 24 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Angular-Material-Confirm-Dialog/283906e0eb50090f9e418d478077904a726b4c59/CompleteAngularMaterialApp/src/favicon.ico -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CompleteAngularMaterialApp 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/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 | }; -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 22 | // import 'core-js/es6/symbol'; 23 | // import 'core-js/es6/object'; 24 | // import 'core-js/es6/function'; 25 | // import 'core-js/es6/parse-int'; 26 | // import 'core-js/es6/parse-float'; 27 | // import 'core-js/es6/number'; 28 | // import 'core-js/es6/math'; 29 | // import 'core-js/es6/string'; 30 | // import 'core-js/es6/date'; 31 | // import 'core-js/es6/array'; 32 | // import 'core-js/es6/regexp'; 33 | // import 'core-js/es6/map'; 34 | // import 'core-js/es6/weak-map'; 35 | // import 'core-js/es6/set'; 36 | 37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 38 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 39 | 40 | /** IE10 and IE11 requires the following for the Reflect API. */ 41 | // import 'core-js/es6/reflect'; 42 | 43 | 44 | /** Evergreen browsers require these. **/ 45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. 46 | import 'core-js/es7/reflect'; 47 | 48 | 49 | /** 50 | * Web Animations `@angular/platform-browser/animations` 51 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 52 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 53 | **/ 54 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 55 | 56 | /** 57 | * By default, zone.js will patch all possible macroTask and DomEvents 58 | * user can disable parts of macroTask/DomEvents patch by setting following flags 59 | */ 60 | 61 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 62 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 63 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 64 | 65 | /* 66 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 67 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 68 | */ 69 | // (window as any).__Zone_enable_cross_context_check = true; 70 | 71 | /*************************************************************************************************** 72 | * Zone JS is required by default for Angular itself. 73 | */ 74 | import 'zone.js/dist/zone'; // Included with Angular CLI. 75 | 76 | 77 | 78 | /*************************************************************************************************** 79 | * APPLICATION IMPORTS 80 | */ 81 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | @import "~@angular/material/prebuilt-themes/indigo-pink.css"; 3 | 4 | div.container{ 5 | margin: 0px 40px; 6 | } 7 | 8 | .fill-remaining-space { 9 | /* This fills the remaining space, by using flexbox. 10 | Every toolbar row uses a flexbox row layout. */ 11 | flex: 1 1 auto; 12 | } 13 | 14 | form.normal-form{ 15 | margin: 10px; 16 | } 17 | 18 | .controles-container{ 19 | width: 100%; 20 | padding: 5%; 21 | } 22 | 23 | .controles-container > * { 24 | width: 100%; 25 | } 26 | 27 | .add-bottom-padding{ 28 | padding-bottom: 10px; 29 | } 30 | /* radio group */ 31 | mat-radio-group mat-radio-button{ 32 | margin-left: 5px; 33 | } 34 | 35 | .button-row button{ 36 | margin: 5px; 37 | } 38 | 39 | /* notification */ 40 | snack-bar-container.success { 41 | background-color: #5cb85c; 42 | color : #fff; 43 | } 44 | 45 | snack-bar-container.warn { 46 | background-color: #f99157; 47 | color : #fff; 48 | } 49 | 50 | 51 | snack-bar-container.notification simple-snack-bar{ 52 | font-size: 18px !important; 53 | font-weight: bold; 54 | } 55 | 56 | 57 | .hide{ 58 | display: none; 59 | } 60 | 61 | /* mat-table */ 62 | mat-footer-row mat-footer-cell{ 63 | justify-content: center; 64 | font-style: italic; 65 | } 66 | 67 | /* filter controls */ 68 | .search-div{ 69 | margin: 10px; 70 | } 71 | .search-form-field{ 72 | width: 60%; 73 | margin-left: 10px; 74 | padding: 5px 10px; 75 | background-color: #f5f5f5; 76 | border-radius: 5px; 77 | } 78 | .search-form-field div.mat-form-field-underline { 79 | display: none; 80 | } 81 | .search-form-field div.mat-form-field-infix{ 82 | border-top: 0px; 83 | } 84 | .search-form-field div.mat-form-field-wrapper{ 85 | padding-bottom: 0px; 86 | } 87 | .search-form-field div.mat-form-field-suffix button{ 88 | height: 32px; 89 | width: 32px; 90 | } 91 | 92 | /* for dialog pop-up */ 93 | .btn-dialog-close{ 94 | width: 45px; 95 | min-width: 0px !important; 96 | height: 40px; 97 | padding: 0px !important; 98 | } 99 | 100 | /* mat-confirm-dialog (customised dialog) */ 101 | .confirm-dialog-container .mat-dialog-container { 102 | border-radius: .25em .25em .4em .4em; 103 | padding: 0px; 104 | } 105 | .confirm-dialog-container .content-container{ 106 | margin: 5px 5px 15px 5px; 107 | color: #8f9cb5; 108 | display: flex; 109 | } 110 | .confirm-dialog-container #close-icon{ 111 | margin-left: auto; 112 | order: 2; 113 | font-weight: bolder; 114 | } 115 | .confirm-dialog-container #close-icon:hover{ 116 | cursor: pointer; 117 | } 118 | 119 | .confirm-dialog-container #no-button{ 120 | height: 50px; 121 | width: 50%; 122 | background-color: #fc7169; 123 | color:white; 124 | border-radius: 0px; 125 | } 126 | 127 | .confirm-dialog-container #yes-button{ 128 | height: 50px; 129 | width: 50%; 130 | background-color: #b6bece; 131 | color:white; 132 | border-radius: 0px; 133 | } 134 | 135 | .confirm-dialog-container span.content-span{ 136 | padding: 35px 16px; 137 | text-align: center; 138 | font-size: 20px; 139 | } -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/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 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "es2015", 6 | "types": [] 7 | }, 8 | "exclude": [ 9 | "src/test.ts", 10 | "**/*.spec.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "module": "commonjs", 6 | "types": [ 7 | "jasmine", 8 | "node" 9 | ] 10 | }, 11 | "files": [ 12 | "test.ts", 13 | "polyfills.ts" 14 | ], 15 | "include": [ 16 | "**/*.spec.ts", 17 | "**/*.d.ts" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/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 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "moduleResolution": "node", 9 | "emitDecoratorMetadata": true, 10 | "experimentalDecorators": true, 11 | "target": "es5", 12 | "typeRoots": [ 13 | "node_modules/@types" 14 | ], 15 | "lib": [ 16 | "es2017", 17 | "dom" 18 | ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /CompleteAngularMaterialApp/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": true, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-blacklist": [ 20 | true, 21 | "rxjs/Rx" 22 | ], 23 | "import-spacing": true, 24 | "indent": [ 25 | true, 26 | "spaces" 27 | ], 28 | "interface-over-type-literal": true, 29 | "label-position": true, 30 | "max-line-length": [ 31 | true, 32 | 140 33 | ], 34 | "member-access": false, 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-arg": true, 47 | "no-bitwise": true, 48 | "no-console": [ 49 | true, 50 | "debug", 51 | "info", 52 | "time", 53 | "timeEnd", 54 | "trace" 55 | ], 56 | "no-construct": true, 57 | "no-debugger": true, 58 | "no-duplicate-super": true, 59 | "no-empty": false, 60 | "no-empty-interface": true, 61 | "no-eval": true, 62 | "no-inferrable-types": [ 63 | true, 64 | "ignore-params" 65 | ], 66 | "no-misused-new": true, 67 | "no-non-null-assertion": true, 68 | "no-shadowed-variable": true, 69 | "no-string-literal": false, 70 | "no-string-throw": true, 71 | "no-switch-case-fall-through": true, 72 | "no-trailing-whitespace": true, 73 | "no-unnecessary-initializer": true, 74 | "no-unused-expression": true, 75 | "no-use-before-declare": true, 76 | "no-var-keyword": true, 77 | "object-literal-sort-keys": false, 78 | "one-line": [ 79 | true, 80 | "check-open-brace", 81 | "check-catch", 82 | "check-else", 83 | "check-whitespace" 84 | ], 85 | "prefer-const": true, 86 | "quotemark": [ 87 | true, 88 | "single" 89 | ], 90 | "radix": true, 91 | "semicolon": [ 92 | true, 93 | "always" 94 | ], 95 | "triple-equals": [ 96 | true, 97 | "allow-null-check" 98 | ], 99 | "typedef-whitespace": [ 100 | true, 101 | { 102 | "call-signature": "nospace", 103 | "index-signature": "nospace", 104 | "parameter": "nospace", 105 | "property-declaration": "nospace", 106 | "variable-declaration": "nospace" 107 | } 108 | ], 109 | "unified-signatures": true, 110 | "variable-name": false, 111 | "whitespace": [ 112 | true, 113 | "check-branch", 114 | "check-decl", 115 | "check-operator", 116 | "check-separator", 117 | "check-type" 118 | ], 119 | "no-output-on-prefix": true, 120 | "use-input-property-decorator": true, 121 | "use-output-property-decorator": true, 122 | "use-host-property-decorator": true, 123 | "no-input-rename": true, 124 | "no-output-rename": true, 125 | "use-life-cycle-interface": true, 126 | "use-pipe-transform-interface": true, 127 | "component-class-suffix": true, 128 | "directive-class-suffix": true 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Angular Material Confirm Dialog 2 | 3 | Content discussed : 4 | - angular material confirm dialog 5 | - customize angular confirmation 6 | 7 | ## Get the Code 8 | 9 | ``` 10 | $ git clone https://github.com/CodAffection/Angular-Material-Confirm-Dialog.git 11 | $ cd Angular-Material-Confirm-Dialog/CompleteAngularMaterialApp 12 | $ npm install 13 | //run the app 14 | $ ng serve 15 | ``` 16 | 17 | ## How it works ? 18 | 19 | :tv: Video tutorial on this same topic 20 | Url : https://youtu.be/L7mrAYsh0-0 21 | 22 | Video Tutorial for Angular Material Popup Dialog & Model 25 | 26 | ## Complete Angular Material Tutorial 27 | 1. Form Design - https://goo.gl/XmR6Li [_this one_] 28 | 2. Firebase CRUD - https://goo.gl/3VQn29 29 | 3. Angular Material Data Table - https://goo.gl/5h59y5 30 | 4. Material Popup - https://goo.gl/NNf5sp 31 | 5. Material Confirm Dialog - https://goo.gl/pr8rs6 32 | 33 | 34 | | :bar_chart: | List of Tutorials | | :moneybag: | Support Us | 35 | |--------------------------:|:---------------------|---|---------------------:|:-------------------------------------| 36 | | Angular |http://bit.ly/2KQN9xF | |Paypal | https://goo.gl/bPcyXW | 37 | | Asp.Net Core |http://bit.ly/30fPDMg | |Amazon Affiliate | https://geni.us/JDzpE | 38 | | React |http://bit.ly/325temF | | 39 | | Python |http://bit.ly/2ws4utg | | :point_right: | Follow Us | 40 | | Node.js |https://goo.gl/viJcFs | |Website |http://www.codaffection.com | 41 | | Asp.Net MVC |https://goo.gl/gvjUJ7 | |YouTube |https://www.youtube.com/codaffection | 42 | | Flutter |https://bit.ly/3ggmmJz| |Facebook |https://www.facebook.com/codaffection | 43 | | Web API |https://goo.gl/itVayJ | |Twitter |https://twitter.com/CodAffection | 44 | | MEAN Stack |https://goo.gl/YJPPAH | | 45 | | C# Tutorial |https://goo.gl/s1zJxo | | 46 | | Asp.Net WebForm |https://goo.gl/GXC2aJ | | 47 | | C# WinForm |https://goo.gl/vHS9Hd | | 48 | | MS SQL |https://goo.gl/MLYS9e | | 49 | | Crystal Report |https://goo.gl/5Vou7t | | 50 | | CG Exercises in C Program |https://goo.gl/qEWJCs | | 51 | --------------------------------------------------------------------------------