├── .browserslistrc
├── .editorconfig
├── .gitignore
├── README.md
├── angular.json
├── karma.conf.js
├── package-lock.json
├── package.json
├── src
├── app
│ ├── app-routing.module.ts
│ ├── app.component.css
│ ├── app.component.html
│ ├── app.component.spec.ts
│ ├── app.component.ts
│ ├── app.module.ts
│ ├── component
│ │ ├── dashboard
│ │ │ ├── dashboard.component.css
│ │ │ ├── dashboard.component.html
│ │ │ ├── dashboard.component.spec.ts
│ │ │ └── dashboard.component.ts
│ │ ├── fileupload
│ │ │ ├── fileupload.component.css
│ │ │ ├── fileupload.component.html
│ │ │ ├── fileupload.component.spec.ts
│ │ │ └── fileupload.component.ts
│ │ ├── forgot-password
│ │ │ ├── forgot-password.component.css
│ │ │ ├── forgot-password.component.html
│ │ │ ├── forgot-password.component.spec.ts
│ │ │ └── forgot-password.component.ts
│ │ ├── login
│ │ │ ├── login.component.css
│ │ │ ├── login.component.html
│ │ │ ├── login.component.spec.ts
│ │ │ └── login.component.ts
│ │ ├── register
│ │ │ ├── register.component.css
│ │ │ ├── register.component.html
│ │ │ ├── register.component.spec.ts
│ │ │ └── register.component.ts
│ │ └── varify-email
│ │ │ ├── varify-email.component.css
│ │ │ ├── varify-email.component.html
│ │ │ ├── varify-email.component.spec.ts
│ │ │ └── varify-email.component.ts
│ ├── model
│ │ ├── file-meta-data.ts
│ │ └── student.ts
│ └── shared
│ │ ├── auth.service.spec.ts
│ │ ├── auth.service.ts
│ │ ├── data.service.spec.ts
│ │ ├── data.service.ts
│ │ ├── file.service.spec.ts
│ │ └── file.service.ts
├── assets
│ ├── .gitkeep
│ └── icons8-google-48.png
├── environments
│ ├── environment.prod.ts
│ └── environment.ts
├── favicon.ico
├── index.html
├── main.ts
├── polyfills.ts
├── styles.css
└── test.ts
├── tsconfig.app.json
├── tsconfig.json
└── tsconfig.spec.json
/.browserslistrc:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # For the full list of supported browsers by the Angular framework, please see:
6 | # https://angular.io/guide/browser-support
7 |
8 | # You can see what browsers were selected by your queries by running:
9 | # npx browserslist
10 |
11 | last 1 Chrome version
12 | last 1 Firefox version
13 | last 2 Edge major versions
14 | last 2 Safari major versions
15 | last 2 iOS major versions
16 | Firefox ESR
17 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
18 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see https://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.ts]
12 | quote_type = single
13 |
14 | [*.md]
15 | max_line_length = off
16 | trim_trailing_whitespace = false
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 | # Only exists if Bazel was run
8 | /bazel-out
9 |
10 | # dependencies
11 | /node_modules
12 |
13 | # profiling files
14 | chrome-profiler-events*.json
15 |
16 | # IDEs and editors
17 | /.idea
18 | .project
19 | .classpath
20 | .c9/
21 | *.launch
22 | .settings/
23 | *.sublime-workspace
24 |
25 | # IDE - VSCode
26 | .vscode/*
27 | !.vscode/settings.json
28 | !.vscode/tasks.json
29 | !.vscode/launch.json
30 | !.vscode/extensions.json
31 | .history/*
32 |
33 | # misc
34 | /.sass-cache
35 | /connect.lock
36 | /coverage
37 | /libpeerconnection.log
38 | npm-debug.log
39 | yarn-error.log
40 | testem.log
41 | /typings
42 |
43 | # System Files
44 | .DS_Store
45 | Thumbs.db
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FirebaseAngularCrud
2 |
3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.8.
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.
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 a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
24 |
25 | ## Further help
26 |
27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
28 |
--------------------------------------------------------------------------------
/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "firebase-angular-crud": {
7 | "projectType": "application",
8 | "schematics": {
9 | "@schematics/angular:application": {
10 | "strict": true
11 | }
12 | },
13 | "root": "",
14 | "sourceRoot": "src",
15 | "prefix": "app",
16 | "architect": {
17 | "build": {
18 | "builder": "@angular-devkit/build-angular:browser",
19 | "options": {
20 | "outputPath": "dist/firebase-angular-crud",
21 | "index": "src/index.html",
22 | "main": "src/main.ts",
23 | "polyfills": "src/polyfills.ts",
24 | "tsConfig": "tsconfig.app.json",
25 | "assets": [
26 | "src/favicon.ico",
27 | "src/assets"
28 | ],
29 | "styles": [
30 | "src/styles.css"
31 | ],
32 | "scripts": []
33 | },
34 | "configurations": {
35 | "production": {
36 | "budgets": [
37 | {
38 | "type": "initial",
39 | "maximumWarning": "500kb",
40 | "maximumError": "1mb"
41 | },
42 | {
43 | "type": "anyComponentStyle",
44 | "maximumWarning": "2kb",
45 | "maximumError": "4kb"
46 | }
47 | ],
48 | "fileReplacements": [
49 | {
50 | "replace": "src/environments/environment.ts",
51 | "with": "src/environments/environment.prod.ts"
52 | }
53 | ],
54 | "outputHashing": "all"
55 | },
56 | "development": {
57 | "buildOptimizer": false,
58 | "optimization": false,
59 | "vendorChunk": true,
60 | "extractLicenses": false,
61 | "sourceMap": true,
62 | "namedChunks": true
63 | }
64 | },
65 | "defaultConfiguration": "production"
66 | },
67 | "serve": {
68 | "builder": "@angular-devkit/build-angular:dev-server",
69 | "configurations": {
70 | "production": {
71 | "browserTarget": "firebase-angular-crud:build:production"
72 | },
73 | "development": {
74 | "browserTarget": "firebase-angular-crud:build:development"
75 | }
76 | },
77 | "defaultConfiguration": "development"
78 | },
79 | "extract-i18n": {
80 | "builder": "@angular-devkit/build-angular:extract-i18n",
81 | "options": {
82 | "browserTarget": "firebase-angular-crud:build"
83 | }
84 | },
85 | "test": {
86 | "builder": "@angular-devkit/build-angular:karma",
87 | "options": {
88 | "main": "src/test.ts",
89 | "polyfills": "src/polyfills.ts",
90 | "tsConfig": "tsconfig.spec.json",
91 | "karmaConfig": "karma.conf.js",
92 | "assets": [
93 | "src/favicon.ico",
94 | "src/assets"
95 | ],
96 | "styles": [
97 | "src/styles.css"
98 | ],
99 | "scripts": []
100 | }
101 | }
102 | }
103 | }
104 | },
105 | "defaultProject": "firebase-angular-crud"
106 | }
107 |
--------------------------------------------------------------------------------
/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | jasmine: {
17 | // you can add configuration options for Jasmine here
18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19 | // for example, you can disable the random execution with `random: false`
20 | // or set a specific seed with `seed: 4321`
21 | },
22 | clearContext: false // leave Jasmine Spec Runner output visible in browser
23 | },
24 | jasmineHtmlReporter: {
25 | suppressAll: true // removes the duplicated traces
26 | },
27 | coverageReporter: {
28 | dir: require('path').join(__dirname, './coverage/firebase-angular-crud'),
29 | subdir: '.',
30 | reporters: [
31 | { type: 'html' },
32 | { type: 'text-summary' }
33 | ]
34 | },
35 | reporters: ['progress', 'kjhtml'],
36 | port: 9876,
37 | colors: true,
38 | logLevel: config.LOG_INFO,
39 | autoWatch: true,
40 | browsers: ['Chrome'],
41 | singleRun: false,
42 | restartOnFileChange: true
43 | });
44 | };
45 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "firebase-angular-crud",
3 | "version": "0.0.0",
4 | "scripts": {
5 | "ng": "ng",
6 | "start": "ng serve",
7 | "build": "ng build",
8 | "watch": "ng build --watch --configuration development",
9 | "test": "ng test"
10 | },
11 | "private": true,
12 | "dependencies": {
13 | "@angular/animations": "~12.2.0",
14 | "@angular/common": "~12.2.0",
15 | "@angular/compiler": "~12.2.0",
16 | "@angular/core": "~12.2.0",
17 | "@angular/fire": "^7.2.0",
18 | "@angular/forms": "~12.2.0",
19 | "@angular/platform-browser": "~12.2.0",
20 | "@angular/platform-browser-dynamic": "~12.2.0",
21 | "@angular/router": "~12.2.0",
22 | "rxjs": "~6.6.0",
23 | "tslib": "^2.3.0",
24 | "zone.js": "~0.11.4",
25 | "firebase": "^9.4.0",
26 | "rxfire": "^6.0.0"
27 | },
28 | "devDependencies": {
29 | "@angular-devkit/build-angular": "~12.2.8",
30 | "@angular/cli": "~12.2.8",
31 | "@angular/compiler-cli": "~12.2.0",
32 | "@types/jasmine": "~3.8.0",
33 | "@types/node": "^12.11.1",
34 | "jasmine-core": "~3.8.0",
35 | "karma": "~6.3.0",
36 | "karma-chrome-launcher": "~3.1.0",
37 | "karma-coverage": "~2.0.3",
38 | "karma-jasmine": "~4.0.0",
39 | "karma-jasmine-html-reporter": "~1.7.0",
40 | "typescript": "~4.3.5"
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/app/app-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { RouterModule, Routes } from '@angular/router';
3 | import { DashboardComponent } from './component/dashboard/dashboard.component';
4 | import { FileuploadComponent } from './component/fileupload/fileupload.component';
5 | import { ForgotPasswordComponent } from './component/forgot-password/forgot-password.component';
6 | import { LoginComponent } from './component/login/login.component';
7 | import { RegisterComponent } from './component/register/register.component';
8 | import { VarifyEmailComponent } from './component/varify-email/varify-email.component';
9 |
10 | const routes: Routes = [
11 | {path: '', redirectTo:'file-upload', pathMatch:'full'},
12 | {path: 'login', component : LoginComponent},
13 | {path: 'dashboard', component : DashboardComponent},
14 | {path: 'register', component : RegisterComponent},
15 | {path: 'varify-email', component : VarifyEmailComponent},
16 | {path: 'forgot-password', component : ForgotPasswordComponent},
17 | {path : 'file-upload', component:FileuploadComponent}
18 | ];
19 |
20 | @NgModule({
21 | imports: [RouterModule.forRoot(routes)],
22 | exports: [RouterModule]
23 | })
24 | export class AppRoutingModule { }
25 |
--------------------------------------------------------------------------------
/src/app/app.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code1ogic/Angular-Firebase-crud/f22207efcef2ce7dd47c9eb0753d7ebe9df70178/src/app/app.component.css
--------------------------------------------------------------------------------
/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 | import { RouterTestingModule } from '@angular/router/testing';
3 | import { AppComponent } from './app.component';
4 |
5 | describe('AppComponent', () => {
6 | beforeEach(async () => {
7 | await TestBed.configureTestingModule({
8 | imports: [
9 | RouterTestingModule
10 | ],
11 | declarations: [
12 | AppComponent
13 | ],
14 | }).compileComponents();
15 | });
16 |
17 | it('should create the app', () => {
18 | const fixture = TestBed.createComponent(AppComponent);
19 | const app = fixture.componentInstance;
20 | expect(app).toBeTruthy();
21 | });
22 |
23 | it(`should have as title 'firebase-angular-crud'`, () => {
24 | const fixture = TestBed.createComponent(AppComponent);
25 | const app = fixture.componentInstance;
26 | expect(app.title).toEqual('firebase-angular-crud');
27 | });
28 |
29 | it('should render title', () => {
30 | const fixture = TestBed.createComponent(AppComponent);
31 | fixture.detectChanges();
32 | const compiled = fixture.nativeElement as HTMLElement;
33 | expect(compiled.querySelector('.content span')?.textContent).toContain('firebase-angular-crud app is running!');
34 | });
35 | });
36 |
--------------------------------------------------------------------------------
/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-root',
5 | templateUrl: './app.component.html',
6 | styleUrls: ['./app.component.css']
7 | })
8 | export class AppComponent {
9 | title = 'AngularFirebaseconnect';
10 | }
11 |
--------------------------------------------------------------------------------
/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { BrowserModule } from '@angular/platform-browser';
3 |
4 | import { AppRoutingModule } from './app-routing.module';
5 | import { AppComponent } from './app.component';
6 | import { AngularFireModule } from '@angular/fire/compat'
7 | import { environment } from 'src/environments/environment';
8 | import { LoginComponent } from './component/login/login.component';
9 | import { RegisterComponent } from './component/register/register.component';
10 | import { DashboardComponent } from './component/dashboard/dashboard.component';
11 | import { FormsModule } from '@angular/forms';
12 | import { ForgotPasswordComponent } from './component/forgot-password/forgot-password.component';
13 | import { VarifyEmailComponent } from './component/varify-email/varify-email.component';
14 | import { AngularFirestore } from '@angular/fire/compat/firestore';
15 | import { FileuploadComponent } from './component/fileupload/fileupload.component'
16 |
17 | @NgModule({
18 | declarations: [
19 | AppComponent,
20 | LoginComponent,
21 | RegisterComponent,
22 | DashboardComponent,
23 | ForgotPasswordComponent,
24 | VarifyEmailComponent,
25 | FileuploadComponent
26 | ],
27 | imports: [
28 | BrowserModule,
29 | AppRoutingModule,
30 | AngularFireModule.initializeApp(environment.firebase),
31 | FormsModule
32 | ],
33 | providers: [],
34 | bootstrap: [AppComponent]
35 | })
36 | export class AppModule { }
37 |
--------------------------------------------------------------------------------
/src/app/component/dashboard/dashboard.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code1ogic/Angular-Firebase-crud/f22207efcef2ce7dd47c9eb0753d7ebe9df70178/src/app/component/dashboard/dashboard.component.css
--------------------------------------------------------------------------------
/src/app/component/dashboard/dashboard.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
Add Student
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
Student List
30 |
31 |
32 |
33 |
34 |
35 | First name |
36 | Last name |
37 | Email |
38 | Mobile |
39 | Action |
40 |
41 |
42 |
43 |
44 | {{studnet.first_name}} |
45 | {{studnet.last_name}} |
46 | {{studnet.email}} |
47 | {{studnet.mobile}} |
48 |
49 |
50 | |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/src/app/component/dashboard/dashboard.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { DashboardComponent } from './dashboard.component';
4 |
5 | describe('DashboardComponent', () => {
6 | let component: DashboardComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | declarations: [ DashboardComponent ]
12 | })
13 | .compileComponents();
14 | });
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(DashboardComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/component/dashboard/dashboard.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { Student } from 'src/app/model/student';
3 | import { AuthService } from 'src/app/shared/auth.service';
4 | import { DataService } from 'src/app/shared/data.service';
5 |
6 | @Component({
7 | selector: 'app-dashboard',
8 | templateUrl: './dashboard.component.html',
9 | styleUrls: ['./dashboard.component.css']
10 | })
11 | export class DashboardComponent implements OnInit {
12 |
13 | studentsList: Student[] = [];
14 | studentObj: Student = {
15 | id: '',
16 | first_name: '',
17 | last_name: '',
18 | email: '',
19 | mobile: ''
20 | };
21 | id: string = '';
22 | first_name: string = '';
23 | last_name: string = '';
24 | email: string = '';
25 | mobile: string = '';
26 |
27 | constructor(private auth: AuthService, private data: DataService) { }
28 |
29 | ngOnInit(): void {
30 | this.getAllStudents();
31 | }
32 |
33 | // register() {
34 | // this.auth.logout();
35 | // }
36 |
37 | getAllStudents() {
38 |
39 | this.data.getAllStudents().subscribe(res => {
40 |
41 | this.studentsList = res.map((e: any) => {
42 | const data = e.payload.doc.data();
43 | data.id = e.payload.doc.id;
44 | return data;
45 | })
46 |
47 | }, err => {
48 | alert('Error while fetching student data');
49 | })
50 |
51 | }
52 |
53 | resetForm() {
54 | this.id = '';
55 | this.first_name = '';
56 | this.last_name = '';
57 | this.email = '';
58 | this.mobile = '';
59 | }
60 |
61 | addStudent() {
62 | if (this.first_name == '' || this.last_name == '' || this.mobile == '' || this.email == '') {
63 | alert('Fill all input fields');
64 | return;
65 | }
66 |
67 | this.studentObj.id = '';
68 | this.studentObj.email = this.email;
69 | this.studentObj.first_name = this.first_name;
70 | this.studentObj.last_name = this.last_name;
71 | this.studentObj.mobile = this.mobile;
72 |
73 | this.data.addStudent(this.studentObj);
74 | this.resetForm();
75 |
76 | }
77 |
78 | updateStudent() {
79 |
80 | }
81 |
82 | deleteStudent(student: Student) {
83 | if (window.confirm('Are you sure you want to delete ' + student.first_name + ' ' + student.last_name + ' ?')) {
84 | this.data.deleteStudent(student);
85 | }
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/src/app/component/fileupload/fileupload.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code1ogic/Angular-Firebase-crud/f22207efcef2ce7dd47c9eb0753d7ebe9df70178/src/app/component/fileupload/fileupload.component.css
--------------------------------------------------------------------------------
/src/app/component/fileupload/fileupload.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
x
8 |
9 |
10 |
11 |
12 |
13 |
14 |
17 | {{percentage}}%
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
File list
30 |
31 |
32 |
33 |
34 |
35 | File name |
36 | File size |
37 | Action |
38 |
39 |
40 |
41 |
42 | {{file.name}} |
43 | {{file.size}} |
44 |
45 | Download
46 | Delete
47 | |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/src/app/component/fileupload/fileupload.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { FileuploadComponent } from './fileupload.component';
4 |
5 | describe('FileuploadComponent', () => {
6 | let component: FileuploadComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | declarations: [ FileuploadComponent ]
12 | })
13 | .compileComponents();
14 | });
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(FileuploadComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/component/fileupload/fileupload.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { AngularFireStorage } from '@angular/fire/compat/storage';
3 | import { FileMetaData } from 'src/app/model/file-meta-data';
4 | import { FileService } from 'src/app/shared/file.service';
5 | import { finalize } from 'rxjs/operators';
6 | import { empty } from 'rxjs';
7 | import { DataService } from 'src/app/shared/data.service';
8 |
9 | @Component({
10 | selector: 'app-fileupload',
11 | templateUrl: './fileupload.component.html',
12 | styleUrls: ['./fileupload.component.css']
13 | })
14 | export class FileuploadComponent implements OnInit {
15 |
16 | selectedFiles !: FileList;
17 | currentFileUpload !: FileMetaData;
18 | percentage: number = 0;
19 |
20 | listOfFiles : FileMetaData[] = [];
21 |
22 |
23 | constructor(private fileService: FileService, private fireStorage: AngularFireStorage, private dataService : DataService) { }
24 |
25 | ngOnInit(): void {
26 | this.getAllFiles();
27 | }
28 |
29 | selectFile(event: any) {
30 | this.selectedFiles = event.target.files;
31 | }
32 |
33 | uploadFile() {
34 | this.currentFileUpload = new FileMetaData(this.selectedFiles[0]);
35 | const path = 'Uploads/'+this.currentFileUpload.file.name;
36 |
37 | const storageRef = this.fireStorage.ref(path);
38 | const uploadTask = storageRef.put(this.selectedFiles[0]);
39 |
40 | uploadTask.snapshotChanges().pipe(finalize( () => {
41 | storageRef.getDownloadURL().subscribe(downloadLink => {
42 | this.currentFileUpload.id = '';
43 | this.currentFileUpload.url = downloadLink;
44 | this.currentFileUpload.size = this.currentFileUpload.file.size;
45 | this.currentFileUpload.name = this.currentFileUpload.file.name;
46 |
47 | this.fileService.saveMetaDataOfFile(this.currentFileUpload);
48 | })
49 | this.ngOnInit();
50 | })
51 | ).subscribe( (res : any) => {
52 | this.percentage = (res.bytesTransferred * 100 / res.totalBytes);
53 | }, err => {
54 | console.log('Error occured');
55 | });
56 |
57 | }
58 |
59 | getAllFiles() {
60 | this.fileService.getAllFiles().subscribe( res => {
61 | this.listOfFiles = res.map((e : any) => {
62 | const data = e.payload.doc.data();
63 | data.id = e.payload.doc.id;
64 | //console.log(data);
65 | return data;
66 | });
67 | }, err => {
68 | console.log('Error occured while fetching file meta data');
69 | })
70 | }
71 |
72 | deleteFile(file : FileMetaData) {
73 |
74 | if(window.confirm('Are you sure you want to delete '+file.name + '?')) {
75 | this.fileService.deleteFile(file);
76 | this.ngOnInit();
77 | }
78 |
79 | }
80 |
81 | }
82 |
83 |
--------------------------------------------------------------------------------
/src/app/component/forgot-password/forgot-password.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code1ogic/Angular-Firebase-crud/f22207efcef2ce7dd47c9eb0753d7ebe9df70178/src/app/component/forgot-password/forgot-password.component.css
--------------------------------------------------------------------------------
/src/app/component/forgot-password/forgot-password.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/component/forgot-password/forgot-password.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ForgotPasswordComponent } from './forgot-password.component';
4 |
5 | describe('ForgotPasswordComponent', () => {
6 | let component: ForgotPasswordComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | declarations: [ ForgotPasswordComponent ]
12 | })
13 | .compileComponents();
14 | });
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ForgotPasswordComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/component/forgot-password/forgot-password.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { AuthService } from 'src/app/shared/auth.service';
3 |
4 | @Component({
5 | selector: 'app-forgot-password',
6 | templateUrl: './forgot-password.component.html',
7 | styleUrls: ['./forgot-password.component.css']
8 | })
9 | export class ForgotPasswordComponent implements OnInit {
10 |
11 | email : string = '';
12 |
13 | constructor(private auth : AuthService) { }
14 |
15 | ngOnInit(): void {
16 | }
17 |
18 | forgotPassword() {
19 | this.auth.forgotPassword(this.email);
20 | this.email = '';
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/app/component/login/login.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code1ogic/Angular-Firebase-crud/f22207efcef2ce7dd47c9eb0753d7ebe9df70178/src/app/component/login/login.component.css
--------------------------------------------------------------------------------
/src/app/component/login/login.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/component/login/login.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { LoginComponent } from './login.component';
4 |
5 | describe('LoginComponent', () => {
6 | let component: LoginComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | declarations: [ LoginComponent ]
12 | })
13 | .compileComponents();
14 | });
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(LoginComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/component/login/login.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { AuthService } from 'src/app/shared/auth.service';
3 |
4 | @Component({
5 | selector: 'app-login',
6 | templateUrl: './login.component.html',
7 | styleUrls: ['./login.component.css']
8 | })
9 | export class LoginComponent implements OnInit {
10 |
11 | email : string = '';
12 | password : string = '';
13 |
14 | constructor(private auth : AuthService) { }
15 |
16 | ngOnInit(): void {
17 | }
18 |
19 | login() {
20 |
21 | if(this.email == '') {
22 | alert('Please enter email');
23 | return;
24 | }
25 |
26 | if(this.password == '') {
27 | alert('Please enter password');
28 | return;
29 | }
30 |
31 | this.auth.login(this.email,this.password);
32 |
33 | this.email = '';
34 | this.password = '';
35 |
36 | }
37 |
38 | signInWithGoogle() {
39 | this.auth.googleSignIn();
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/app/component/register/register.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code1ogic/Angular-Firebase-crud/f22207efcef2ce7dd47c9eb0753d7ebe9df70178/src/app/component/register/register.component.css
--------------------------------------------------------------------------------
/src/app/component/register/register.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/component/register/register.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { RegisterComponent } from './register.component';
4 |
5 | describe('RegisterComponent', () => {
6 | let component: RegisterComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | declarations: [ RegisterComponent ]
12 | })
13 | .compileComponents();
14 | });
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(RegisterComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/component/register/register.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { AuthService } from 'src/app/shared/auth.service';
3 |
4 | @Component({
5 | selector: 'app-register',
6 | templateUrl: './register.component.html',
7 | styleUrls: ['./register.component.css']
8 | })
9 | export class RegisterComponent implements OnInit {
10 |
11 | email : string = '';
12 | password : string = '';
13 |
14 | constructor(private auth : AuthService) { }
15 |
16 | ngOnInit(): void {
17 | }
18 |
19 | register() {
20 |
21 | if(this.email == '') {
22 | alert('Please enter email');
23 | return;
24 | }
25 |
26 | if(this.password == '') {
27 | alert('Please enter password');
28 | return;
29 | }
30 |
31 | this.auth.register(this.email,this.password);
32 |
33 | this.email = '';
34 | this.password = '';
35 |
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/app/component/varify-email/varify-email.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code1ogic/Angular-Firebase-crud/f22207efcef2ce7dd47c9eb0753d7ebe9df70178/src/app/component/varify-email/varify-email.component.css
--------------------------------------------------------------------------------
/src/app/component/varify-email/varify-email.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/component/varify-email/varify-email.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { VarifyEmailComponent } from './varify-email.component';
4 |
5 | describe('VarifyEmailComponent', () => {
6 | let component: VarifyEmailComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | declarations: [ VarifyEmailComponent ]
12 | })
13 | .compileComponents();
14 | });
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(VarifyEmailComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/component/varify-email/varify-email.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-varify-email',
5 | templateUrl: './varify-email.component.html',
6 | styleUrls: ['./varify-email.component.css']
7 | })
8 | export class VarifyEmailComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit(): void {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/app/model/file-meta-data.ts:
--------------------------------------------------------------------------------
1 | export class FileMetaData {
2 | id : string ='';
3 | name : string = '';
4 | size : number = 0;
5 | file : File;
6 | url : string = '';
7 |
8 | constructor(file : File) {
9 | this.file = file;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/app/model/student.ts:
--------------------------------------------------------------------------------
1 | export interface Student {
2 | id : string,
3 | first_name : string,
4 | last_name : string,
5 | email : string,
6 | mobile : string
7 | }
8 |
--------------------------------------------------------------------------------
/src/app/shared/auth.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 |
3 | import { AuthService } from './auth.service';
4 |
5 | describe('AuthService', () => {
6 | let service: AuthService;
7 |
8 | beforeEach(() => {
9 | TestBed.configureTestingModule({});
10 | service = TestBed.inject(AuthService);
11 | });
12 |
13 | it('should be created', () => {
14 | expect(service).toBeTruthy();
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/src/app/shared/auth.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { AngularFireAuth } from '@angular/fire/compat/auth';
3 | import { GoogleAuthProvider, GithubAuthProvider, FacebookAuthProvider} from '@angular/fire/auth'
4 | import { Router } from '@angular/router';
5 |
6 | @Injectable({
7 | providedIn: 'root'
8 | })
9 | export class AuthService {
10 |
11 | constructor(private fireauth : AngularFireAuth, private router : Router) { }
12 |
13 | // login method
14 | login(email : string, password : string) {
15 | this.fireauth.signInWithEmailAndPassword(email,password).then( res => {
16 | localStorage.setItem('token','true');
17 |
18 | if(res.user?.emailVerified == true) {
19 | this.router.navigate(['dashboard']);
20 | } else {
21 | this.router.navigate(['/varify-email']);
22 | }
23 |
24 | }, err => {
25 | alert(err.message);
26 | this.router.navigate(['/login']);
27 | })
28 | }
29 |
30 | // register method
31 | register(email : string, password : string) {
32 | this.fireauth.createUserWithEmailAndPassword(email, password).then( res => {
33 | alert('Registration Successful');
34 | this.sendEmailForVarification(res.user);
35 | this.router.navigate(['/login']);
36 | }, err => {
37 | alert(err.message);
38 | this.router.navigate(['/register']);
39 | })
40 | }
41 |
42 | // sign out
43 | logout() {
44 | this.fireauth.signOut().then( () => {
45 | localStorage.removeItem('token');
46 | this.router.navigate(['/login']);
47 | }, err => {
48 | alert(err.message);
49 | })
50 | }
51 |
52 | // forgot password
53 | forgotPassword(email : string) {
54 | this.fireauth.sendPasswordResetEmail(email).then(() => {
55 | this.router.navigate(['/varify-email']);
56 | }, err => {
57 | alert('Something went wrong');
58 | })
59 | }
60 |
61 | // email varification
62 | sendEmailForVarification(user : any) {
63 | console.log(user);
64 | user.sendEmailVerification().then((res : any) => {
65 | this.router.navigate(['/varify-email']);
66 | }, (err : any) => {
67 | alert('Something went wrong. Not able to send mail to your email.')
68 | })
69 | }
70 |
71 | //sign in with google
72 | googleSignIn() {
73 | return this.fireauth.signInWithPopup(new GoogleAuthProvider).then(res => {
74 |
75 | this.router.navigate(['/dashboard']);
76 | localStorage.setItem('token',JSON.stringify(res.user?.uid));
77 |
78 | }, err => {
79 | alert(err.message);
80 | })
81 | }
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/src/app/shared/data.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 |
3 | import { DataService } from './data.service';
4 |
5 | describe('DataService', () => {
6 | let service: DataService;
7 |
8 | beforeEach(() => {
9 | TestBed.configureTestingModule({});
10 | service = TestBed.inject(DataService);
11 | });
12 |
13 | it('should be created', () => {
14 | expect(service).toBeTruthy();
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/src/app/shared/data.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { AngularFirestore } from '@angular/fire/compat/firestore';
3 | import { AngularFireStorage } from '@angular/fire/compat/storage';
4 | import { FileMetaData } from '../model/file-meta-data';
5 | import { Student } from '../model/student';
6 |
7 | @Injectable({
8 | providedIn: 'root'
9 | })
10 | export class DataService {
11 |
12 | constructor(private afs : AngularFirestore, private fireStorage : AngularFireStorage) { }
13 |
14 |
15 | // add student
16 | addStudent(student : Student) {
17 | student.id = this.afs.createId();
18 | return this.afs.collection('/Students').add(student);
19 | }
20 |
21 | // get all students
22 | getAllStudents() {
23 | return this.afs.collection('/Students').snapshotChanges();
24 | }
25 |
26 | // delete student
27 | deleteStudent(student : Student) {
28 | this.afs.doc('/Students/'+student.id).delete();
29 | }
30 |
31 | // update student
32 | updateStudent(student : Student) {
33 | this.deleteStudent(student);
34 | this.addStudent(student);
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/app/shared/file.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 |
3 | import { FileService } from './file.service';
4 |
5 | describe('FileService', () => {
6 | let service: FileService;
7 |
8 | beforeEach(() => {
9 | TestBed.configureTestingModule({});
10 | service = TestBed.inject(FileService);
11 | });
12 |
13 | it('should be created', () => {
14 | expect(service).toBeTruthy();
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/src/app/shared/file.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import {AngularFireStorage} from '@angular/fire/compat/storage';
3 | import {AngularFirestore} from '@angular/fire/compat/firestore'
4 | import { FileMetaData } from '../model/file-meta-data';
5 |
6 | @Injectable({
7 | providedIn: 'root'
8 | })
9 | export class FileService {
10 |
11 | constructor(private fireStore : AngularFirestore, private fireStorage : AngularFireStorage) { }
12 |
13 | // save meta data of file to firestore
14 | saveMetaDataOfFile(fileObj : FileMetaData) {
15 |
16 | const fileMeta = {
17 | id : '',
18 | name : fileObj.name,
19 | url : fileObj.url,
20 | size : fileObj.size
21 | }
22 |
23 | fileMeta.id = this.fireStore.createId();
24 |
25 | this.fireStore.collection('/Upload').add(fileMeta);
26 |
27 | }
28 |
29 | // dislpay all files
30 | getAllFiles() {
31 | return this.fireStore.collection('/Upload').snapshotChanges();
32 | }
33 |
34 | // delete file
35 | deleteFile(fileMeta : FileMetaData) {
36 |
37 | this.fireStore.collection('/Upload').doc(fileMeta.id).delete();
38 | this.fireStorage.ref('/Uploads/'+fileMeta.name).delete();
39 |
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code1ogic/Angular-Firebase-crud/f22207efcef2ce7dd47c9eb0753d7ebe9df70178/src/assets/.gitkeep
--------------------------------------------------------------------------------
/src/assets/icons8-google-48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code1ogic/Angular-Firebase-crud/f22207efcef2ce7dd47c9eb0753d7ebe9df70178/src/assets/icons8-google-48.png
--------------------------------------------------------------------------------
/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build` 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 | firebase : {
8 | apiKey: "AIzaSyDbhdWawp0lmRKtCzg_0jmA_dy_pk2gKfg",
9 | authDomain: "hotel-management-3390d.firebaseapp.com",
10 | projectId: "hotel-management-3390d",
11 | storageBucket: "hotel-management-3390d.appspot.com",
12 | messagingSenderId: "1010076842792",
13 | appId: "1:1010076842792:web:a1f076a7eb815a0aae6e1d"
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/plugins/zone-error'; // Included with Angular CLI.
25 |
--------------------------------------------------------------------------------
/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code1ogic/Angular-Firebase-crud/f22207efcef2ce7dd47c9eb0753d7ebe9df70178/src/favicon.ico
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | FirebaseAngularCrud
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | platformBrowserDynamic().bootstrapModule(AppModule)
12 | .catch(err => console.error(err));
13 |
--------------------------------------------------------------------------------
/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/guide/browser-support
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /**
22 | * IE11 requires the following for NgClass support on SVG elements
23 | */
24 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
25 |
26 | /**
27 | * Web Animations `@angular/platform-browser/animations`
28 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
29 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
30 | */
31 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
32 |
33 | /**
34 | * By default, zone.js will patch all possible macroTask and DomEvents
35 | * user can disable parts of macroTask/DomEvents patch by setting following flags
36 | * because those flags need to be set before `zone.js` being loaded, and webpack
37 | * will put import in the top of bundle, so user need to create a separate file
38 | * in this directory (for example: zone-flags.ts), and put the following flags
39 | * into that file, and then add the following code before importing zone.js.
40 | * import './zone-flags';
41 | *
42 | * The flags allowed in zone-flags.ts are listed here.
43 | *
44 | * The following flags will work for all browsers.
45 | *
46 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
47 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
48 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
49 | *
50 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
51 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
52 | *
53 | * (window as any).__Zone_enable_cross_context_check = true;
54 | *
55 | */
56 |
57 | /***************************************************************************************************
58 | * Zone JS is required by default for Angular itself.
59 | */
60 | import 'zone.js'; // Included with Angular CLI.
61 |
62 |
63 | /***************************************************************************************************
64 | * APPLICATION IMPORTS
65 | */
66 |
--------------------------------------------------------------------------------
/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/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/testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: {
11 | context(path: string, deep?: boolean, filter?: RegExp): {
12 | keys(): string[];
13 | (id: string): T;
14 | };
15 | };
16 |
17 | // First, initialize the Angular testing environment.
18 | getTestBed().initTestEnvironment(
19 | BrowserDynamicTestingModule,
20 | platformBrowserDynamicTesting(),
21 | { teardown: { destroyAfterEach: true }},
22 | );
23 |
24 | // Then we find all the tests.
25 | const context = require.context('./', true, /\.spec\.ts$/);
26 | // And load the modules.
27 | context.keys().map(context);
28 |
--------------------------------------------------------------------------------
/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/app",
6 | "types": []
7 | },
8 | "files": [
9 | "src/main.ts",
10 | "src/polyfills.ts"
11 | ],
12 | "include": [
13 | "src/**/*.d.ts"
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "compileOnSave": false,
4 | "compilerOptions": {
5 | "baseUrl": "./",
6 | "outDir": "./dist/out-tsc",
7 | "forceConsistentCasingInFileNames": true,
8 | "strict": true,
9 | "noImplicitReturns": true,
10 | "noFallthroughCasesInSwitch": true,
11 | "sourceMap": true,
12 | "declaration": false,
13 | "downlevelIteration": true,
14 | "experimentalDecorators": true,
15 | "moduleResolution": "node",
16 | "importHelpers": true,
17 | "target": "es2017",
18 | "module": "es2020",
19 | "lib": [
20 | "es2018",
21 | "dom"
22 | ]
23 | },
24 | "angularCompilerOptions": {
25 | "enableI18nLegacyMessageIdFormat": false,
26 | "strictInjectionParameters": true,
27 | "strictInputAccessModifiers": true,
28 | "strictTemplates": true
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/spec",
6 | "types": [
7 | "jasmine"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts",
12 | "src/polyfills.ts"
13 | ],
14 | "include": [
15 | "src/**/*.spec.ts",
16 | "src/**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------