├── .angular-cli.json
├── .editorconfig
├── .gitignore
├── README.md
├── e2e
├── app.e2e-spec.ts
├── app.po.ts
└── tsconfig.e2e.json
├── karma.conf.js
├── package-lock.json
├── package.json
├── protractor.conf.js
├── src
├── app
│ ├── app-routing.module.ts
│ ├── app.component.html
│ ├── app.component.sass
│ ├── app.component.ts
│ ├── app.module.ts
│ ├── data-table
│ │ ├── data-table.component.html
│ │ ├── data-table.component.sass
│ │ └── data-table.component.ts
│ └── edit-dialog
│ │ ├── edit-dialog.component.html
│ │ ├── edit-dialog.component.sass
│ │ └── edit-dialog.component.ts
├── assets
│ └── .gitkeep
├── environments
│ ├── environment.prod.ts
│ └── environment.ts
├── favicon.ico
├── index.html
├── main.ts
├── polyfills.ts
├── styles.sass
├── test.ts
├── tsconfig.app.json
├── tsconfig.spec.json
└── typings.d.ts
├── tsconfig.json
└── tslint.json
/.angular-cli.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "project": {
4 | "name": "base"
5 | },
6 | "apps": [
7 | {
8 | "root": "src",
9 | "outDir": "dist",
10 | "assets": [
11 | "assets",
12 | "favicon.ico"
13 | ],
14 | "index": "index.html",
15 | "main": "main.ts",
16 | "polyfills": "polyfills.ts",
17 | "test": "test.ts",
18 | "tsconfig": "tsconfig.app.json",
19 | "testTsconfig": "tsconfig.spec.json",
20 | "prefix": "",
21 | "serviceWorker": false,
22 | "styles": [
23 | "styles.sass"
24 | ],
25 | "scripts": [],
26 | "environmentSource": "environments/environment.ts",
27 | "environments": {
28 | "dev": "environments/environment.ts",
29 | "prod": "environments/environment.prod.ts"
30 | }
31 | }
32 | ],
33 | "e2e": {
34 | "protractor": {
35 | "config": "./protractor.conf.js"
36 | }
37 | },
38 | "lint": [
39 | {
40 | "project": "src/tsconfig.app.json",
41 | "exclude": "**/node_modules/**"
42 | },
43 | {
44 | "project": "src/tsconfig.spec.json",
45 | "exclude": "**/node_modules/**"
46 | },
47 | {
48 | "project": "e2e/tsconfig.e2e.json",
49 | "exclude": "**/node_modules/**"
50 | }
51 | ],
52 | "test": {
53 | "karma": {
54 | "config": "./karma.conf.js"
55 | }
56 | },
57 | "defaults": {
58 | "styleExt": "sass",
59 | "class": {
60 | "spec": false
61 | },
62 | "component": {
63 | "spec": false
64 | },
65 | "directive": {
66 | "spec": false
67 | },
68 | "guard": {
69 | "spec": false
70 | },
71 | "module": {
72 | "spec": false
73 | },
74 | "pipe": {
75 | "spec": false
76 | },
77 | "service": {
78 | "spec": false
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # /src/environments/environment.prod.ts
4 | # /src/environments/environment.ts
5 | NOTES.md
6 | functions/node_modules
7 |
8 | /src/env.ts
9 |
10 | # compiled output
11 | /dist
12 | /tmp
13 | /out-tsc
14 |
15 | # dependencies
16 | /node_modules
17 |
18 | # IDEs and editors
19 | /.idea
20 | .project
21 | .classpath
22 | .c9/
23 | *.launch
24 | .settings/
25 | *.sublime-workspace
26 |
27 | # IDE - VSCode
28 | .vscode/*
29 | !.vscode/settings.json
30 | !.vscode/tasks.json
31 | !.vscode/launch.json
32 | !.vscode/extensions.json
33 |
34 | # misc
35 | /.sass-cache
36 | /connect.lock
37 | /coverage
38 | /libpeerconnection.log
39 | npm-debug.log
40 | testem.log
41 | /typings
42 |
43 | # e2e
44 | /e2e/*.js
45 | /e2e/*.map
46 |
47 | # System Files
48 | .DS_Store
49 | Thumbs.db
50 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Episode 76
2 |
3 | Watch the [firestore data table screencast]()
4 |
5 | ## Usage
6 |
7 | - `git clone`
8 | - create the `src/enviornments/environment.ts` file and add your firebase config to it
9 | - `npm install`
10 | - `ng serve`
11 |
--------------------------------------------------------------------------------
/e2e/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 |
3 | describe('base 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 |
--------------------------------------------------------------------------------
/e2e/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 |
--------------------------------------------------------------------------------
/e2e/tsconfig.e2e.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/e2e",
5 | "baseUrl": "./",
6 | "module": "commonjs",
7 | "target": "es5",
8 | "types": [
9 | "jasmine",
10 | "jasminewd2",
11 | "node"
12 | ]
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/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/cli'],
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/cli/plugins/karma')
14 | ],
15 | client:{
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | reports: [ 'html', 'lcovonly' ],
20 | fixWebpackSourcePaths: true
21 | },
22 | angularCli: {
23 | environment: 'dev'
24 | },
25 | reporters: ['progress', 'kjhtml'],
26 | port: 9876,
27 | colors: true,
28 | logLevel: config.LOG_INFO,
29 | autoWatch: true,
30 | browsers: ['Chrome'],
31 | singleRun: false
32 | });
33 | };
34 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "base",
3 | "version": "0.0.0",
4 | "license": "MIT",
5 | "scripts": {
6 | "ng": "ng",
7 | "start": "ng serve",
8 | "build": "ng build",
9 | "test": "ng test",
10 | "lint": "ng lint",
11 | "e2e": "ng e2e"
12 | },
13 | "private": true,
14 | "dependencies": {
15 | "@angular/animations": "^5.1.0",
16 | "@angular/cdk": "^5.0.1",
17 | "@angular/common": "^5.1.0",
18 | "@angular/compiler": "^5.1.0",
19 | "@angular/core": "^5.1.0",
20 | "@angular/forms": "^5.1.0",
21 | "@angular/http": "^5.1.0",
22 | "@angular/material": "^5.0.1",
23 | "@angular/platform-browser": "^5.1.0",
24 | "@angular/platform-browser-dynamic": "^5.1.0",
25 | "@angular/platform-server": "^5.1.0",
26 | "@angular/router": "^5.1.0",
27 | "@angular/service-worker": "^5.1.0",
28 | "angularfire2": "^5.0.0-rc.4",
29 | "core-js": "^2.4.1",
30 | "faker": "^4.1.0",
31 | "firebase": "^4.8.0",
32 | "rxjs": "^5.5.2",
33 | "zone.js": "^0.8.14"
34 | },
35 | "devDependencies": {
36 | "@angular/cli": "^1.6.0",
37 | "@angular/compiler-cli": "^5.1.0",
38 | "@angular/language-service": "^4.4.6",
39 | "@types/faker": "^4.1.2",
40 | "@types/jasmine": "~2.5.53",
41 | "@types/jasminewd2": "~2.0.2",
42 | "@types/node": "~6.0.60",
43 | "codelyzer": "~3.2.0",
44 | "jasmine-core": "~2.6.2",
45 | "jasmine-spec-reporter": "~4.1.0",
46 | "karma": "~1.7.0",
47 | "karma-chrome-launcher": "~2.1.1",
48 | "karma-cli": "~1.0.1",
49 | "karma-coverage-istanbul-reporter": "^1.2.1",
50 | "karma-jasmine": "~1.1.0",
51 | "karma-jasmine-html-reporter": "^0.2.2",
52 | "protractor": "~5.1.2",
53 | "ts-node": "~3.2.0",
54 | "tslint": "~5.7.0",
55 | "typescript": "^2.4.2"
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/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 | './e2e/**/*.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: 'e2e/tsconfig.e2e.json'
25 | });
26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
27 | }
28 | };
29 |
--------------------------------------------------------------------------------
/src/app/app-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 |
4 | const routes: Routes = [];
5 |
6 | @NgModule({
7 | imports: [RouterModule.forRoot(routes)],
8 | exports: [RouterModule]
9 | })
10 | export class AppRoutingModule { }
11 |
--------------------------------------------------------------------------------
/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/app.component.sass:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngularFirebase/76-material-datatable-firestore/c07622e26e850fe7e9830243708608d83d5f3236/src/app/app.component.sass
--------------------------------------------------------------------------------
/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 |
4 | @Component({
5 | selector: 'app-root',
6 | templateUrl: './app.component.html',
7 | styleUrls: ['./app.component.sass']
8 | })
9 | export class AppComponent {
10 | }
11 |
--------------------------------------------------------------------------------
/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import { NgModule } from '@angular/core';
3 |
4 | import { AppRoutingModule } from './app-routing.module';
5 | import { AppComponent } from './app.component';
6 |
7 | import { environment } from '../environments/environment';
8 |
9 | import { AngularFireAuthModule } from 'angularfire2/auth';
10 |
11 | /// DELETE firebaseConfig
12 | /// Add your own firebase config to environment.ts
13 | /// Then use it to initialize angularfire2 AngularFireModule.initializeApp(environment.firebaseConfig),
14 | import { firebaseConfig } from '../env';
15 |
16 |
17 | import { AngularFireModule } from 'angularfire2';
18 | import { AngularFirestoreModule } from 'angularfire2/firestore';
19 |
20 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
21 | import { FormsModule } from '@angular/forms'
22 |
23 | import {
24 | MatTableModule,
25 | MatFormFieldModule,
26 | MatInputModule,
27 | MatSortModule,
28 | MatDialogModule,
29 | MatButtonModule
30 | } from '@angular/material';
31 |
32 | import { EditDialogComponent } from './edit-dialog/edit-dialog.component';
33 | import { DataTableComponent } from './data-table/data-table.component';
34 |
35 | @NgModule({
36 | declarations: [
37 | AppComponent,
38 | EditDialogComponent,
39 | DataTableComponent
40 | ],
41 | imports: [
42 | BrowserModule,
43 | AppRoutingModule,
44 | BrowserAnimationsModule,
45 | FormsModule,
46 | MatTableModule,
47 | MatFormFieldModule,
48 | MatInputModule,
49 | MatSortModule,
50 | MatDialogModule,
51 | MatButtonModule,
52 | AngularFireModule.initializeApp(firebaseConfig),
53 | AngularFirestoreModule
54 | ],
55 | providers: [],
56 | bootstrap: [AppComponent],
57 | entryComponents: [EditDialogComponent]
58 | })
59 | export class AppModule { }
60 |
--------------------------------------------------------------------------------
/src/app/data-table/data-table.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
12 |
13 | Name
14 | {{ hacker.name }}
15 |
16 |
17 |
18 |
19 | age
20 | {{ hacker.age }}
21 |
22 |
23 |
24 |
25 | Email
26 | {{ hacker.email }}
27 |
28 |
29 |
30 |
31 | Phrase
32 | {{ hacker.phrase }}
33 |
34 |
35 |
36 | Edit
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/src/app/data-table/data-table.component.sass:
--------------------------------------------------------------------------------
1 | .example-container
2 | display: flex
3 | flex-direction: column
4 | min-width: 300px
5 |
6 | .example-header
7 | min-height: 64px
8 | padding: 8px 24px 0
9 |
10 | .mat-form-field
11 | font-size: 14px
12 | width: 100%
13 |
14 | .mat-table
15 | overflow: auto
16 |
17 | .mat-accent
18 | margin-bottom: 10px
19 |
20 | @-webkit-keyframes fadeIt
21 | 0%
22 | background-color: #FFFFFF
23 |
24 | 50%
25 | background-color: #98FB98
26 |
27 | 100%
28 | background-color: #FFFFFF
29 |
30 |
31 | .animate
32 | background-image: none !important
33 | animation: fadeIt 1s ease-in-out
--------------------------------------------------------------------------------
/src/app/data-table/data-table.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, AfterViewInit, ViewChild } from '@angular/core';
2 |
3 | import { AngularFirestore } from 'angularfire2/firestore';
4 |
5 | import { MatTableDataSource, MatSort, MatDialog } from '@angular/material';
6 | import { EditDialogComponent } from '../edit-dialog/edit-dialog.component';
7 |
8 | import * as faker from 'faker';
9 |
10 | @Component({
11 | selector: 'data-table',
12 | templateUrl: './data-table.component.html',
13 | styleUrls: ['./data-table.component.sass']
14 | })
15 | export class DataTableComponent implements AfterViewInit {
16 |
17 | displayedColumns = ['name', 'age', 'email', 'phrase', 'edit'];
18 | dataSource: MatTableDataSource;
19 |
20 | @ViewChild(MatSort) sort: MatSort;
21 |
22 | constructor(private afs: AngularFirestore, public dialog: MatDialog) { }
23 |
24 |
25 | ngAfterViewInit() {
26 | this.afs.collection('hackers').valueChanges().subscribe(data => {
27 | this.dataSource = new MatTableDataSource(data);
28 | this.dataSource.sort = this.sort;
29 | })
30 | }
31 |
32 | applyFilter(filterValue: string) {
33 | filterValue = filterValue.trim();
34 | filterValue = filterValue.toLowerCase();
35 | this.dataSource.filter = filterValue;
36 | }
37 |
38 | openDialog(data): void {
39 | const dialogRef = this.dialog.open(EditDialogComponent, {
40 | width: '350px',
41 | data: data
42 | });
43 | }
44 |
45 |
46 | // Database seeding
47 | addOne() {
48 | const hacker = {
49 | name: faker.name.findName(),
50 | age: faker.random.number({ min: 18, max: 99 }),
51 | email: faker.internet.email(),
52 | phrase: faker.hacker.phrase(),
53 | uid: faker.random.alphaNumeric(16)
54 | }
55 | this.afs.collection('hackers').doc(hacker.uid).set(hacker)
56 | }
57 |
58 | trackByUid(index, item) {
59 | return item.uid;
60 | }
61 |
62 |
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/app/edit-dialog/edit-dialog.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/app/edit-dialog/edit-dialog.component.sass:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngularFirebase/76-material-datatable-firestore/c07622e26e850fe7e9830243708608d83d5f3236/src/app/edit-dialog/edit-dialog.component.sass
--------------------------------------------------------------------------------
/src/app/edit-dialog/edit-dialog.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, Inject } from '@angular/core';
2 | import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
3 | import { AngularFirestore } from 'angularfire2/firestore';
4 |
5 | @Component({
6 | selector: 'edit-dialog',
7 | templateUrl: './edit-dialog.component.html',
8 | styleUrls: ['./edit-dialog.component.sass']
9 | })
10 | export class EditDialogComponent {
11 |
12 | newEmail: string;
13 |
14 | constructor(
15 | private afs: AngularFirestore,
16 | public dialogRef: MatDialogRef,
17 | @Inject(MAT_DIALOG_DATA) public data: any) { }
18 |
19 | onNoClick(): void {
20 | this.dialogRef.close();
21 | }
22 |
23 | updateEmail(): void {
24 | this.afs.collection('hackers').doc(this.data.uid).update({ email: this.newEmail })
25 | this.dialogRef.close();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngularFirebase/76-material-datatable-firestore/c07622e26e850fe7e9830243708608d83d5f3236/src/assets/.gitkeep
--------------------------------------------------------------------------------
/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // The file contents for the current environment will overwrite these during build.
2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do
3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead.
4 | // The list of which env maps to which file can be found in `.angular-cli.json`.
5 |
6 | export const environment = {
7 | production: false
8 | };
9 |
--------------------------------------------------------------------------------
/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AngularFirebase/76-material-datatable-firestore/c07622e26e850fe7e9830243708608d83d5f3236/src/favicon.ico
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Base
6 |
7 |
8 |
9 |
10 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 | * Required to support Web Animations `@angular/platform-browser/animations`.
51 | * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
52 | **/
53 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
54 |
55 |
56 |
57 | /***************************************************************************************************
58 | * Zone JS is required by Angular itself.
59 | */
60 | import 'zone.js/dist/zone'; // Included with Angular CLI.
61 |
62 |
63 |
64 | /***************************************************************************************************
65 | * APPLICATION IMPORTS
66 | */
67 |
68 | /**
69 | * Date, currency, decimal and percent pipes.
70 | * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
71 | */
72 | // import 'intl'; // Run `npm install --save intl`.
73 | /**
74 | * Need to import at least one locale-data with intl.
75 | */
76 | // import 'intl/locale-data/jsonp/en';
77 |
--------------------------------------------------------------------------------
/src/styles.sass:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 | @import '~@angular/material/prebuilt-themes/deeppurple-amber.css';
--------------------------------------------------------------------------------
/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/long-stack-trace-zone';
4 | import 'zone.js/dist/proxy.js';
5 | import 'zone.js/dist/sync-test';
6 | import 'zone.js/dist/jasmine-patch';
7 | import 'zone.js/dist/async-test';
8 | import 'zone.js/dist/fake-async-test';
9 | import { getTestBed } from '@angular/core/testing';
10 | import {
11 | BrowserDynamicTestingModule,
12 | platformBrowserDynamicTesting
13 | } from '@angular/platform-browser-dynamic/testing';
14 |
15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
16 | declare const __karma__: any;
17 | declare const require: any;
18 |
19 | // Prevent Karma from running prematurely.
20 | __karma__.loaded = function () {};
21 |
22 | // First, initialize the Angular testing environment.
23 | getTestBed().initTestEnvironment(
24 | BrowserDynamicTestingModule,
25 | platformBrowserDynamicTesting()
26 | );
27 | // Then we find all the tests.
28 | const context = require.context('./', true, /\.spec\.ts$/);
29 | // And load the modules.
30 | context.keys().map(context);
31 | // Finally, start Karma to run the tests.
32 | __karma__.start();
33 |
--------------------------------------------------------------------------------
/src/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "baseUrl": "./",
6 | "module": "es2015",
7 | "types": []
8 | },
9 | "exclude": [
10 | "test.ts",
11 | "**/*.spec.ts"
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/src/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/spec",
5 | "baseUrl": "./",
6 | "module": "commonjs",
7 | "target": "es5",
8 | "types": [
9 | "jasmine",
10 | "node"
11 | ]
12 | },
13 | "files": [
14 | "test.ts"
15 | ],
16 | "include": [
17 | "**/*.spec.ts",
18 | "**/*.d.ts"
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/src/typings.d.ts:
--------------------------------------------------------------------------------
1 | /* SystemJS module definition */
2 | declare var module: NodeModule;
3 | interface NodeModule {
4 | id: string;
5 | }
6 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "outDir": "./dist/out-tsc",
5 | "sourceMap": true,
6 | "declaration": false,
7 | "moduleResolution": "node",
8 | "emitDecoratorMetadata": true,
9 | "experimentalDecorators": true,
10 | "target": "es5",
11 | "typeRoots": [
12 | "node_modules/@types"
13 | ],
14 | "lib": [
15 | "es2017",
16 | "dom"
17 | ]
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rulesDirectory": [
3 | "node_modules/codelyzer"
4 | ],
5 | "rules": {
6 | "callable-types": true,
7 | "class-name": true,
8 | "comment-format": [
9 | true,
10 | "check-space"
11 | ],
12 | "curly": true,
13 | "eofline": false,
14 | "forin": true,
15 | "import-blacklist": [true, "rxjs"],
16 | "import-spacing": true,
17 | "indent": [
18 | true,
19 | "spaces"
20 | ],
21 | "interface-over-type-literal": true,
22 | "label-position": true,
23 | "max-line-length": [
24 | true,
25 | 140
26 | ],
27 | "member-access": false,
28 | "member-ordering": [
29 | true,
30 | "static-before-instance",
31 | "variables-before-functions"
32 | ],
33 | "no-arg": true,
34 | "no-bitwise": true,
35 | "no-console": [
36 | true,
37 | "debug",
38 | "info",
39 | "time",
40 | "timeEnd",
41 | "trace"
42 | ],
43 | "no-construct": true,
44 | "no-debugger": true,
45 | "no-duplicate-variable": true,
46 | "no-empty": false,
47 | "no-empty-interface": true,
48 | "no-eval": true,
49 | "no-inferrable-types": [true, "ignore-params"],
50 | "no-shadowed-variable": true,
51 | "no-string-literal": false,
52 | "no-string-throw": true,
53 | "no-switch-case-fall-through": true,
54 | "no-trailing-whitespace": false,
55 | "no-unused-expression": true,
56 | "no-use-before-declare": true,
57 | "no-var-keyword": true,
58 | "object-literal-sort-keys": false,
59 | "one-line": [
60 | true,
61 | "check-open-brace",
62 | "check-catch",
63 | "check-else",
64 | "check-whitespace"
65 | ],
66 | "prefer-const": true,
67 | "quotemark": [
68 | true,
69 | "single"
70 | ],
71 | "radix": true,
72 | "semicolon": [
73 | "always"
74 | ],
75 | "triple-equals": [
76 | true,
77 | "allow-null-check"
78 | ],
79 | "typedef-whitespace": [
80 | true,
81 | {
82 | "call-signature": "nospace",
83 | "index-signature": "nospace",
84 | "parameter": "nospace",
85 | "property-declaration": "nospace",
86 | "variable-declaration": "nospace"
87 | }
88 | ],
89 | "typeof-compare": true,
90 | "unified-signatures": true,
91 | "variable-name": false,
92 | "whitespace": [
93 | true,
94 | "check-branch",
95 | "check-decl",
96 | "check-operator",
97 | "check-separator",
98 | "check-type"
99 | ],
100 |
101 | "directive-selector": [true, "attribute", "", "camelCase"],
102 | "component-selector": [true, "element", "", "kebab-case"],
103 | "use-input-property-decorator": true,
104 | "use-output-property-decorator": true,
105 | "use-host-property-decorator": true,
106 | "no-input-rename": true,
107 | "no-output-rename": true,
108 | "use-life-cycle-interface": true,
109 | "use-pipe-transform-interface": true,
110 | "component-class-suffix": true,
111 | "directive-class-suffix": true,
112 | "no-access-missing-member": true,
113 | "templates-use-public": true,
114 | "invoke-injectable": true
115 | }
116 | }
117 |
--------------------------------------------------------------------------------