├── .gitignore
├── README.md
├── angular-cli.json
├── firebase.json
├── karma.conf.js
├── package.json
├── protractor.conf.js
├── scripts
└── install-staged.sh
├── src
├── app
│ ├── app.component.css
│ ├── app.component.html
│ ├── app.component.ts
│ ├── app.module.ts
│ └── index.ts
├── environments
│ ├── environment.dev.ts
│ ├── environment.prod.ts
│ └── environment.ts
├── favicon.ico
├── index.html
├── main.ts
├── material2-app-theme.scss
├── polyfills.ts
├── styles.css
├── test.ts
├── tsconfig.json
└── typings.d.ts
└── tslint.json
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 |
7 | # dependencies
8 | /node_modules
9 | /bower_components
10 |
11 | # generated code
12 | aot/
13 |
14 | # IDEs and editors
15 | /.idea
16 |
17 | # misc
18 | /.sass-cache
19 | /connect.lock
20 | /coverage/*
21 | /libpeerconnection.log
22 | npm-debug.log
23 | testem.log
24 | /typings
25 |
26 | # e2e
27 | /e2e/*.js
28 | /e2e/*.map
29 |
30 | #System Files
31 | .DS_Store
32 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # material2-app
2 | Simple app that consumes Angular Material 2 components. Built with the `angular-cli`.
3 |
4 | See it live: https://material2-app.firebaseapp.com/
5 |
--------------------------------------------------------------------------------
/angular-cli.json:
--------------------------------------------------------------------------------
1 | {
2 | "project": {
3 | "version": "1.0.0-beta.11-webpack.8",
4 | "name": "material2-app"
5 | },
6 | "apps": [
7 | {
8 | "root": "src",
9 | "outDir": "dist",
10 | "assets": "assets",
11 | "index": "index.html",
12 | "main": "main.ts",
13 | "test": "test.ts",
14 | "tsconfig": "tsconfig.json",
15 | "prefix": "app",
16 | "mobile": false,
17 | "styles": [
18 | "styles.css",
19 | "material2-app-theme.scss"
20 | ],
21 | "scripts": [],
22 | "environments": {
23 | "source": "environments/environment.ts",
24 | "prod": "environments/environment.prod.ts",
25 | "dev": "environments/environment.dev.ts"
26 | }
27 | }
28 | ],
29 | "addons": [],
30 | "packages": [],
31 | "e2e": {
32 | "protractor": {
33 | "config": "./protractor.conf.js"
34 | }
35 | },
36 | "test": {
37 | "karma": {
38 | "config": "./karma.conf.js"
39 | }
40 | },
41 | "defaults": {
42 | "styleExt": "css",
43 | "prefixInterfaces": false,
44 | "lazyRoutePrefix": "+"
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "hosting": {
3 | "public": "dist",
4 | "rewrites": [
5 | {
6 | "source": "/**/!(*.@(js|ts|html|css|json|svg|png|jpg|jpeg))",
7 | "destination": "/index.html"
8 | }
9 | ],
10 | "headers": [
11 | {
12 | "source": "**/*.@(eot|otf|ttf|ttc|woff|font.css)",
13 | "headers": [
14 | {
15 | "key": "Access-Control-Allow-Origin",
16 | "value": "*"
17 | }
18 | ]
19 | }
20 | ],
21 | "ignore": [
22 | "firebase.json"
23 | ]
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/0.13/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-remap-istanbul'),
12 | require('angular-cli/plugins/karma')
13 | ],
14 | files: [
15 | { pattern: './src/test.ts', watched: false }
16 | ],
17 | preprocessors: {
18 | './src/test.ts': ['angular-cli']
19 | },
20 | remapIstanbulReporter: {
21 | reports: {
22 | html: 'coverage',
23 | lcovonly: './coverage/coverage.lcov'
24 | }
25 | },
26 | angularCliConfig: './angular-cli.json',
27 | reporters: ['progress', 'karma-remap-istanbul'],
28 | port: 9876,
29 | colors: true,
30 | logLevel: config.LOG_INFO,
31 | autoWatch: true,
32 | browsers: ['Chrome'],
33 | singleRun: false
34 | });
35 | };
36 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "m2-app",
3 | "version": "0.0.0",
4 | "license": "MIT",
5 | "angular-cli": {},
6 | "scripts": {
7 | "start": "ng serve",
8 | "lint": "tslint \"src/**/*.ts\"",
9 | "test": "ng test",
10 | "pree2e": "webdriver-manager update",
11 | "e2e": "protractor"
12 | },
13 | "private": true,
14 | "dependencies": {
15 | "@angular/common": "^2.0.0",
16 | "@angular/compiler": "^2.0.0",
17 | "@angular/core": "^2.0.0",
18 | "@angular/forms": "^2.0.0",
19 | "@angular/http": "^2.0.0",
20 | "@angular/platform-browser": "^2.0.0",
21 | "@angular/platform-browser-dynamic": "^2.0.0",
22 | "@angular/material": "2.0.0-alpha.10",
23 | "@angular/router": "^3.0.0",
24 | "core-js": "^2.4.0",
25 | "rxjs": "5.0.0-beta.12",
26 | "ts-helpers": "^1.1.1",
27 | "zone.js": "^0.6.21"
28 | },
29 | "devDependencies": {
30 | "@angular/compiler-cli": "^2.0.0",
31 | "@angular/platform-server": "^2.0.0",
32 | "@types/hammerjs": "^2.0.32",
33 | "@types/jasmine": "^2.2.30",
34 | "angular-cli": "^1.0.0-beta.16",
35 | "codelyzer": "~0.0.26",
36 | "firebase-tools": "^3.0.7",
37 | "jasmine-core": "2.4.1",
38 | "jasmine-spec-reporter": "2.5.0",
39 | "karma": "0.13.22",
40 | "karma-chrome-launcher": "0.2.3",
41 | "karma-jasmine": "0.3.8",
42 | "karma-remap-istanbul": "^0.2.1",
43 | "protractor": "4.0.3",
44 | "ts-node": "1.2.1",
45 | "tslint": "3.13.0",
46 | "typescript": "^2.0.2"
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // Protractor configuration file, see link for more information
2 | // https://github.com/angular/protractor/blob/master/docs/referenceConf.js
3 |
4 | /*global jasmine */
5 | var SpecReporter = require('jasmine-spec-reporter');
6 |
7 | exports.config = {
8 | allScriptsTimeout: 11000,
9 | specs: [
10 | './e2e/**/*.e2e-spec.ts'
11 | ],
12 | capabilities: {
13 | 'browserName': 'chrome'
14 | },
15 | directConnect: true,
16 | baseUrl: 'http://localhost:4200/',
17 | framework: 'jasmine',
18 | jasmineNodeOpts: {
19 | showColors: true,
20 | defaultTimeoutInterval: 30000,
21 | print: function() {}
22 | },
23 | useAllAngular2AppRoots: true,
24 | beforeLaunch: function() {
25 | require('ts-node').register({
26 | project: 'e2e'
27 | });
28 | },
29 | onPrepare: function() {
30 | jasmine.getEnv().addReporter(new SpecReporter());
31 | }
32 | };
33 |
--------------------------------------------------------------------------------
/scripts/install-staged.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -ex
3 |
4 | rm -rf ./node_modules/@angular/material
5 | mkdir -p ./node_modules/@angular/material
6 | cp -r ~/material2/dist/@angular/material ./node_modules/@angular
7 |
--------------------------------------------------------------------------------
/src/app/app.component.css:
--------------------------------------------------------------------------------
1 | md-sidenav-layout.m2app-dark {
2 | background: black;
3 | }
4 |
5 | .app-content {
6 | padding: 20px;
7 | }
8 |
9 | .app-content md-card {
10 | margin: 20px;
11 | }
12 |
13 | .app-sidenav {
14 | padding: 10px;
15 | min-width: 100px;
16 | }
17 |
18 | .app-content md-checkbox {
19 | margin: 10px;
20 | }
21 |
22 | .app-toolbar-filler {
23 | flex: 1 1 auto;
24 | }
25 |
26 | .app-toolbar-menu {
27 | padding: 0 14px 0 14px;
28 | color: white;
29 | }
30 |
31 | .app-icon-button {
32 | box-shadow: none;
33 | user-select: none;
34 | background: none;
35 | border: none;
36 | cursor: pointer;
37 | filter: none;
38 | font-weight: normal;
39 | height: auto;
40 | line-height: inherit;
41 | margin: 0;
42 | min-width: 0;
43 | padding: 0;
44 | text-align: left;
45 | text-decoration: none;
46 | }
47 |
48 | .app-action {
49 | display: inline-block;
50 | position: fixed;
51 | bottom: 20px;
52 | right: 20px;
53 | }
54 |
55 | .app-spinner {
56 | height: 30px;
57 | width: 30px;
58 | display: inline-block;
59 | }
60 |
61 | .app-input-icon {
62 | font-size: 16px;
63 | }
64 |
65 | .app-list {
66 | border: 1px solid rgba(0,0,0,0.12);
67 | width: 350px;
68 | margin: 20px;
69 | }
70 |
71 | .app-progress {
72 | margin: 20px;
73 | }
74 |
--------------------------------------------------------------------------------
/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Sidenav
5 |
6 |
7 |
8 |
11 |
12 | Angular Material2 Example App
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | Unchecked
29 | Checked
30 | Indeterminate
31 | Disabled
32 |
33 |
34 |
35 | Alpha
36 | Beta
37 | Gamma
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | {{nickname.characterCount}} / 50
46 |
47 |
48 |
49 |
50 |
51 | android Favorite phone
52 |
53 |
54 |
55 |
56 |
57 | motorcycle
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | {{food.name}}
67 | {{food.rating}}
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
85 |
86 |
95 |
96 |
97 |
98 |
99 |
100 | EARTH
101 |
102 |
103 | FIRE
104 |
105 |
106 |
107 |
108 |
109 | build
110 |
111 |
112 |
113 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 | Last dialog result: {{lastDialogResult}}
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
--------------------------------------------------------------------------------
/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, Optional} from '@angular/core';
2 | import {MdDialog, MdDialogRef, MdSnackBar} from '@angular/material';
3 |
4 |
5 | @Component({
6 | selector: 'material2-app-app',
7 | templateUrl: 'app.component.html',
8 | styleUrls: ['app.component.css'],
9 | })
10 | export class Material2AppAppComponent {
11 | isDarkTheme: boolean = false;
12 | lastDialogResult: string;
13 |
14 | foods: any[] = [
15 | {name: 'Pizza', rating: 'Excellent'},
16 | {name: 'Burritos', rating: 'Great'},
17 | {name: 'French fries', rating: 'Pretty good'},
18 | ];
19 |
20 | progress: number = 0;
21 |
22 | constructor(private _dialog: MdDialog, private _snackbar: MdSnackBar) {
23 | // Update the value for the progress-bar on an interval.
24 | setInterval(() => {
25 | this.progress = (this.progress + Math.floor(Math.random() * 4) + 1) % 100;
26 | }, 200);
27 | }
28 |
29 | openDialog() {
30 | let dialogRef = this._dialog.open(DialogContent);
31 |
32 | dialogRef.afterClosed().subscribe(result => {
33 | this.lastDialogResult = result;
34 | })
35 | }
36 |
37 | showSnackbar() {
38 | this._snackbar.open('YUM SNACKS', 'CHEW');
39 | }
40 | }
41 |
42 |
43 | @Component({
44 | template: `
45 |
This is a dialog
46 |
47 |
51 |
52 |
53 | `,
54 | })
55 | export class DialogContent {
56 | constructor(@Optional() public dialogRef: MdDialogRef) { }
57 | }
58 |
--------------------------------------------------------------------------------
/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import {NgModule} from '@angular/core';
2 | import {BrowserModule} from '@angular/platform-browser';
3 | import {MaterialModule} from '@angular/material';
4 | import {Material2AppAppComponent, DialogContent} from './app.component';
5 |
6 | @NgModule({
7 | imports: [
8 | BrowserModule,
9 | MaterialModule.forRoot(),
10 | ],
11 | declarations: [Material2AppAppComponent, DialogContent],
12 | entryComponents: [DialogContent],
13 | bootstrap: [Material2AppAppComponent],
14 | })
15 | export class MaterialAppModule { }
16 |
--------------------------------------------------------------------------------
/src/app/index.ts:
--------------------------------------------------------------------------------
1 | export * from './app.component';
2 | export * from './app.module';
3 |
--------------------------------------------------------------------------------
/src/environments/environment.dev.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: false
3 | };
4 |
--------------------------------------------------------------------------------
/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // The file for the current environment will overwrite this one during build.
2 | // Different environments can be found in ./environment.{dev|prod}.ts, and
3 | // you can create your own and use it with the --env flag.
4 | // The build system defaults to the dev environment.
5 |
6 | export const environment = {
7 | production: false
8 | };
9 |
--------------------------------------------------------------------------------
/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jelbourn/material2-app/bc653a8eb6a4696356a05bf0474f49fe15126a1d/src/favicon.ico
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | M2App
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Loading...
15 |
16 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import './polyfills.ts';
2 | import {enableProdMode} from '@angular/core';
3 | import {environment} from './environments/environment';
4 |
5 |
6 | if (environment.production) {
7 | enableProdMode();
8 | }
9 |
10 | /**
11 | * JIT compile.
12 | */
13 |
14 | // import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
15 | // import {MaterialAppModule} from './app/app.module';
16 | // platformBrowserDynamic().bootstrapModule(MaterialAppModule);
17 |
18 |
19 | /**
20 | * AoT compile.
21 | * First run `./node_modules/.bin/ngc -p ./src/`
22 | */
23 |
24 | import {platformBrowser} from '@angular/platform-browser';
25 | import {MaterialAppModuleNgFactory} from './aot/app/app.module.ngfactory';
26 | platformBrowser().bootstrapModuleFactory(MaterialAppModuleNgFactory);
27 |
--------------------------------------------------------------------------------
/src/material2-app-theme.scss:
--------------------------------------------------------------------------------
1 | @import '~@angular/material/core/theming/all-theme';
2 |
3 | // NOTE: Theming is currently experimental and not yet publically released!
4 |
5 | @include md-core();
6 |
7 | $primary: md-palette($md-deep-purple);
8 | $accent: md-palette($md-amber, A200, A100, A400);
9 |
10 | $theme: md-light-theme($primary, $accent);
11 |
12 | @include angular-material-theme($theme);
13 |
14 | .m2app-dark {
15 | $dark-primary: md-palette($md-pink, 700, 500, 900);
16 | $dark-accent: md-palette($md-blue-grey, A200, A100, A400);
17 | $dark-warn: md-palette($md-deep-orange);
18 |
19 | $dark-theme: md-dark-theme($dark-primary, $dark-accent, $dark-warn);
20 |
21 | @include angular-material-theme($dark-theme);
22 | }
23 |
--------------------------------------------------------------------------------
/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | // This file includes polyfills needed by Angular 2 and is loaded before
2 | // the app. You can add your own extra polyfills to this file.
3 | import 'core-js/es6/symbol';
4 | import 'core-js/es6/object';
5 | import 'core-js/es6/function';
6 | import 'core-js/es6/parse-int';
7 | import 'core-js/es6/parse-float';
8 | import 'core-js/es6/number';
9 | import 'core-js/es6/math';
10 | import 'core-js/es6/string';
11 | import 'core-js/es6/date';
12 | import 'core-js/es6/array';
13 | import 'core-js/es6/regexp';
14 | import 'core-js/es6/map';
15 | import 'core-js/es6/set';
16 | import 'core-js/es6/reflect';
17 |
18 | import 'core-js/es7/reflect';
19 | import 'zone.js/dist/zone';
20 |
--------------------------------------------------------------------------------
/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
3 | body {
4 | margin: 0;
5 | }
6 |
--------------------------------------------------------------------------------
/src/test.ts:
--------------------------------------------------------------------------------
1 | import './polyfills.ts';
2 |
3 | import 'zone.js/dist/long-stack-trace-zone';
4 | import 'zone.js/dist/jasmine-patch';
5 | import 'zone.js/dist/async-test';
6 | import 'zone.js/dist/fake-async-test';
7 | import 'zone.js/dist/sync-test';
8 |
9 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
10 | declare var __karma__: any;
11 |
12 | // Prevent Karma from running prematurely.
13 | __karma__.loaded = function () {};
14 |
15 |
16 | Promise.all([
17 | System.import('@angular/core/testing'),
18 | System.import('@angular/platform-browser-dynamic/testing')
19 | ])
20 | // First, initialize the Angular testing environment.
21 | .then(([testing, testingBrowser]) => {
22 | testing.getTestBed().initTestEnvironment(
23 | testingBrowser.BrowserDynamicTestingModule,
24 | testingBrowser.platformBrowserDynamicTesting()
25 | );
26 | })
27 | // Then we find all the tests.
28 | .then(() => require.context('./', true, /\.spec\.ts/))
29 | // And load the modules.
30 | .then(context => context.keys().map(context))
31 | // Finally, start Karma to run the tests.
32 | .then(__karma__.start, __karma__.error);
33 |
--------------------------------------------------------------------------------
/src/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "declaration": false,
4 | "emitDecoratorMetadata": true,
5 | "experimentalDecorators": true,
6 | "lib": ["es6", "dom"],
7 | "mapRoot": "./",
8 | "module": "es6",
9 | "moduleResolution": "node",
10 | "outDir": "../dist/out-tsc",
11 | "sourceMap": true,
12 | "target": "es5",
13 | "typeRoots": [
14 | "../node_modules/@types"
15 | ],
16 | "types": ["hammerjs"]
17 | },
18 | "angularCompilerOptions": {
19 | "genDir": "aot",
20 | "skipMetadataEmit" : true
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/typings.d.ts:
--------------------------------------------------------------------------------
1 | // Typings reference file, see links for more information
2 | // https://github.com/typings/typings
3 | // https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html
4 |
5 | declare var System: any;
6 | declare var module: { id: string };
7 | declare var require: any;
8 |
9 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rulesDirectory": [
3 | "node_modules/codelyzer"
4 | ],
5 | "rules": {
6 | "class-name": true,
7 | "comment-format": [
8 | true,
9 | "check-space"
10 | ],
11 | "curly": true,
12 | "eofline": true,
13 | "forin": true,
14 | "indent": [
15 | true,
16 | "spaces"
17 | ],
18 | "label-position": true,
19 | "label-undefined": true,
20 | "max-line-length": [
21 | true,
22 | 140
23 | ],
24 | "member-access": false,
25 | "member-ordering": [
26 | true,
27 | "static-before-instance",
28 | "variables-before-functions"
29 | ],
30 | "no-arg": true,
31 | "no-bitwise": true,
32 | "no-console": [
33 | true,
34 | "debug",
35 | "info",
36 | "time",
37 | "timeEnd",
38 | "trace"
39 | ],
40 | "no-construct": true,
41 | "no-debugger": true,
42 | "no-duplicate-key": true,
43 | "no-duplicate-variable": true,
44 | "no-empty": false,
45 | "no-eval": true,
46 | "no-inferrable-types": true,
47 | "no-shadowed-variable": true,
48 | "no-string-literal": false,
49 | "no-switch-case-fall-through": true,
50 | "no-trailing-whitespace": true,
51 | "no-unused-expression": true,
52 | "no-unused-variable": true,
53 | "no-unreachable": true,
54 | "no-use-before-declare": true,
55 | "no-var-keyword": true,
56 | "object-literal-sort-keys": false,
57 | "one-line": [
58 | true,
59 | "check-open-brace",
60 | "check-catch",
61 | "check-else",
62 | "check-whitespace"
63 | ],
64 | "quotemark": [
65 | true,
66 | "single"
67 | ],
68 | "radix": true,
69 | "semicolon": [
70 | "always"
71 | ],
72 | "triple-equals": [
73 | true,
74 | "allow-null-check"
75 | ],
76 | "typedef-whitespace": [
77 | true,
78 | {
79 | "call-signature": "nospace",
80 | "index-signature": "nospace",
81 | "parameter": "nospace",
82 | "property-declaration": "nospace",
83 | "variable-declaration": "nospace"
84 | }
85 | ],
86 | "variable-name": false,
87 | "whitespace": [
88 | true,
89 | "check-branch",
90 | "check-decl",
91 | "check-operator",
92 | "check-separator",
93 | "check-type"
94 | ],
95 |
96 | "directive-selector-prefix": [true, "app"],
97 | "component-selector-prefix": [true, "app"],
98 | "directive-selector-name": [true, "camelCase"],
99 | "component-selector-name": [true, "kebab-case"],
100 | "directive-selector-type": [true, "attribute"],
101 | "component-selector-type": [true, "element"],
102 | "use-input-property-decorator": true,
103 | "use-output-property-decorator": true,
104 | "use-host-property-decorator": true,
105 | "no-input-rename": true,
106 | "no-output-rename": true,
107 | "use-life-cycle-interface": true,
108 | "use-pipe-transform-interface": true,
109 | "component-class-suffix": true,
110 | "directive-class-suffix": true
111 | }
112 | }
113 |
--------------------------------------------------------------------------------