Skip to content

Commit 4c20d4e

Browse files
committed
Angular Router In Depth
2 parents f8119be + 4b689bb commit 4c20d4e

File tree

131 files changed

+17049
-2062
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+17049
-2062
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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

.gitignore

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,44 @@
1-
node_modules
2-
typings
3-
tsd_typings/
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
8+
tmp.json
9+
10+
# dependencies
11+
/node_modules
12+
13+
# IDEs and editors
14+
/.idea
15+
.project
16+
.classpath
17+
.c9/
18+
*.launch
19+
.settings/
20+
*.sublime-workspace
21+
22+
# IDE - VSCode
23+
.vscode/*
24+
!.vscode/settings.json
25+
!.vscode/tasks.json
26+
!.vscode/launch.json
27+
!.vscode/extensions.json
28+
29+
# misc
30+
/.sass-cache
31+
/connect.lock
32+
/coverage
33+
/libpeerconnection.log
434
npm-debug.log
5-
dist/
6-
.idea
35+
testem.log
36+
/typings
37+
38+
# e2e
39+
/e2e/*.js
40+
/e2e/*.map
41+
42+
# System Files
743
.DS_Store
8-
tmp
44+
Thumbs.db

INIT.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
# Initializing a clean Angular Material Project
3+
4+
These are the commands and steps needed to scaffold a new Angular Material project from scratch,
5+
from an empty folder.
6+
7+
Please make sure to have the latest CLI, and at least NPM 5.
8+
9+
When is doubt, its recommended to update to the latest version of node using a node versioning tool
10+
such as for example [nave](https://github.com/isaacs/nave) or [nvm-windows](https://github.com/coreybutler/nvm-windows).
11+
12+
# Step 1 - Scaffold a clean project using the Angular CLI
13+
14+
With a CLI version 1.5 or above, let's scaffold a new project with routing:
15+
16+
ng new angular-material-hello-world --routing
17+
18+
# Step 2 - Installing Angular Material dependencies
19+
20+
Next, let's install these dependencies:
21+
22+
npm install @angular/material @angular/cdk @angular/animations hammerjs
23+
24+
# Step 3 - Adding Google Material Icons Font
25+
26+
Let's add this to our index.html:
27+
28+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
29+
30+
# Step 4 - choosing a Theme
31+
32+
Before starting to import components, let's choose a widget theme, have a look at the themes available
33+
34+
inside `node_modules/@angular/material/prebuild-themes`.
35+
36+
We can for example use the Indigo Pink theme by adding this line to our styles.css file:
37+
38+
@import "~@angular/material/prebuilt-themes/indigo-pink.css";

angular.json

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"angular-material-course": {
7+
"root": "",
8+
"sourceRoot": "src",
9+
"projectType": "application",
10+
"architect": {
11+
"build": {
12+
"builder": "@angular-devkit/build-angular:browser",
13+
"options": {
14+
"aot": true,
15+
"outputPath": "dist",
16+
"index": "src/index.html",
17+
"main": "src/main.ts",
18+
"tsConfig": "src/tsconfig.app.json",
19+
"polyfills": "src/polyfills.ts",
20+
"assets": [
21+
"src/assets",
22+
"src/favicon.ico"
23+
],
24+
"styles": [
25+
"src/styles.scss"
26+
],
27+
"scripts": []
28+
},
29+
"configurations": {
30+
"production": {
31+
"budgets": [
32+
{
33+
"type": "anyComponentStyle",
34+
"maximumWarning": "6kb"
35+
}
36+
],
37+
"optimization": true,
38+
"outputHashing": "all",
39+
"sourceMap": false,
40+
"extractCss": true,
41+
"namedChunks": false,
42+
"aot": true,
43+
"extractLicenses": true,
44+
"vendorChunk": false,
45+
"buildOptimizer": true,
46+
"fileReplacements": [
47+
{
48+
"replace": "src/environments/environment.ts",
49+
"with": "src/environments/environment.prod.ts"
50+
}
51+
]
52+
}
53+
}
54+
},
55+
"serve": {
56+
"builder": "@angular-devkit/build-angular:dev-server",
57+
"options": {
58+
"browserTarget": "angular-material-course:build"
59+
},
60+
"configurations": {
61+
"production": {
62+
"browserTarget": "angular-material-course:build:production"
63+
}
64+
}
65+
},
66+
"extract-i18n": {
67+
"builder": "@angular-devkit/build-angular:extract-i18n",
68+
"options": {
69+
"browserTarget": "angular-material-course:build"
70+
}
71+
},
72+
"test": {
73+
"builder": "@angular-devkit/build-angular:karma",
74+
"options": {
75+
"main": "src/test.ts",
76+
"karmaConfig": "./karma.conf.js",
77+
"polyfills": "src/polyfills.ts",
78+
"tsConfig": "src/tsconfig.spec.json",
79+
"scripts": [],
80+
"styles": [
81+
"src/styles.scss"
82+
],
83+
"assets": [
84+
"src/assets",
85+
"src/favicon.ico"
86+
]
87+
}
88+
},
89+
"lint": {
90+
"builder": "@angular-devkit/build-angular:tslint",
91+
"options": {
92+
"tsConfig": [
93+
"src/tsconfig.app.json",
94+
"src/tsconfig.spec.json"
95+
],
96+
"exclude": [
97+
"**/node_modules/**"
98+
]
99+
}
100+
}
101+
}
102+
},
103+
"angular-material-course-e2e": {
104+
"root": "",
105+
"sourceRoot": "",
106+
"projectType": "application",
107+
"architect": {
108+
"e2e": {
109+
"builder": "@angular-devkit/build-angular:protractor",
110+
"options": {
111+
"protractorConfig": "./protractor.conf.js",
112+
"devServerTarget": "angular-material-course:serve"
113+
}
114+
},
115+
"lint": {
116+
"builder": "@angular-devkit/build-angular:tslint",
117+
"options": {
118+
"tsConfig": [
119+
"e2e/tsconfig.e2e.json"
120+
],
121+
"exclude": [
122+
"**/node_modules/**"
123+
]
124+
}
125+
}
126+
}
127+
}
128+
},
129+
"defaultProject": "angular-material-course",
130+
"schematics": {
131+
"@schematics/angular:component": {
132+
"styleext": "scss"
133+
},
134+
"@schematics/angular:directive": {
135+
"prefix": ""
136+
}
137+
},
138+
"cli": {
139+
"analytics": "3e2bbd4d-b51b-4bab-8828-77f66d8c5b0d"
140+
}
141+
}

browserslist

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
# You can see what browsers were selected by your queries by running:
6+
# npx browserslist
7+
8+
> 0.5%
9+
last 2 versions
10+
Firefox ESR
11+
not dead
12+
not IE 9-11 # For IE 9-11 support, remove 'not'.

e2e/app.e2e-spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { AppPage } from './app.po';
2+
3+
describe('angular-material-course 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+
});

e2e/app.po.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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+
}

e2e/tsconfig.e2e.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
}

images/dashboard-section-1.png

-27.4 KB
Binary file not shown.

images/dashboard-section-2.png

-26 KB
Binary file not shown.

images/dashboard-section-3.png

-26.7 KB
Binary file not shown.

index.html

Lines changed: 0 additions & 38 deletions
This file was deleted.

karma.conf.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/1.0/config/configuration-file.html
3+
4+
module.exports = function (config) {
5+
config.set({
6+
basePath: '',
7+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-jasmine-html-reporter'),
12+
require('karma-coverage-istanbul-reporter'),
13+
require('@angular-devkit/build-angular/plugins/karma')
14+
],
15+
client:{
16+
clearContext: false // leave Jasmine Spec Runner output visible in browser
17+
},
18+
coverageIstanbulReporter: {
19+
dir: require('path').join(__dirname, 'coverage'), 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+
};

0 commit comments

Comments
 (0)