Skip to content

Commit 2d22099

Browse files
committed
Angular Forms course
0 parents  commit 2d22099

File tree

150 files changed

+6083
-0
lines changed

Some content is hidden

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

150 files changed

+6083
-0
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
node_modules
2+
typings
3+
tsd_typings/
4+
npm-debug.log
5+
dist/
6+
.idea
7+
.DS_Store
8+
tmp
9+
*.js
10+
*.map

favicon.ico

5.3 KB
Binary file not shown.

images/batman.jpg

19.4 KB
Loading

images/dashboard-section-1.png

27.4 KB
Loading

images/dashboard-section-2.png

26 KB
Loading

images/dashboard-section-3.png

26.7 KB
Loading

images/flash.svg

Lines changed: 21 additions & 0 deletions
Loading

images/superman.png

6.4 KB
Loading

index.html

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Really Understanding Angular - The Fundamentals</title>
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
7+
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
8+
<link href="//fonts.googleapis.com/css?family=Roboto:400,300,500,400italic,700" rel="stylesheet" type="text/css">
9+
<link href="//fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
10+
<link rel="stylesheet" href="https://angular-academy.s3-us-west-1.amazonaws.com/styles/angular-academy-lessons-theme-v1.css">
11+
12+
</head>
13+
14+
<body>
15+
16+
<header class="l-header v-center-parent">
17+
<img class="v-center" src="//material.angularjs.org/latest/img/icons/angular-logo.svg">
18+
</header>
19+
20+
<main class="l-main">
21+
22+
<div class="l-course-logo"></div>
23+
<div class="l-course-title">Getting Started with Angular - The Fundamentals</div>
24+
<div class="l-lesson-title">Lessons</div>
25+
26+
<div class="l-course-content card card-strong">
27+
<ul>
28+
<li><a href="src/01-mvc-hello-world">MVC Hello World</a></li>
29+
<li><a href="src/02-template-syntax-properties">Template Syntax - Properties</a></li>
30+
<li><a href="src/03-template-syntax-interpolation">Template Syntax - Interpolation</a></li>
31+
<li><a href="src/04-template-syntax-events">Template Syntax - Events</a></li>
32+
<li><a href="src/components-inputs-and-outputs">Components Inputs And Outputs</a></li>
33+
<li><a href="src/05-template-syntax-components-essentials">Extended Components Example</a></li>
34+
<li><a href="src/exercise-color-sample">Exercise - Create a Color Picker</a></li>
35+
<li><a href="src/directives-intro">Introduction To Directives</a></li>
36+
<li><a href="src/core-directives-ng-for">Core Directives - ngFor</a></li>
37+
<li><a href="src/core-directives-ngstyle-ngclass">Core Directives - ngStyle/ngClass</a></li>
38+
<li><a href="src/core-directives-ngif">Core Directives - ngIf</a></li>
39+
<li><a href="src/directives">Attribute Directives Essentials</a></li>
40+
<li><a href="src/introduction-to-pipes">Introduction To Pipes</a></li>
41+
<li><a href="src/services-intro">Introduction To Services</a></li>
42+
<li><a href="src/modules-intro">Introduction To Modules</a></li>
43+
<li><a href="src/services-http">Services and HTTP In Detail</a></li>
44+
<li><a href="src/forms-template-driven">Template Driven Forms</a></li>
45+
<li><a href="src/forms-model-driven">Model Driven Forms</a></li>
46+
<li><a href="src/forms-signup-exercise">Forms Signup Exercise</a></li>
47+
<li><a href="src/router-introduction">Introduction to the Router</a></li>
48+
<li><a href="src/router-exercise">Router Exercise - Dashboard</a></li>
49+
</ul>
50+
</div>
51+
52+
</main>
53+
54+
</body>
55+
56+
</html>
57+

lessons-server.ts

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
declare const require;
2+
3+
4+
var express = require('express');
5+
var bodyParser = require('body-parser');
6+
var _ = require('lodash');
7+
import {lessonsData} from "./src/services-intro/lessons";
8+
9+
10+
var app = express();
11+
12+
app.use(express.static('.'));
13+
app.use(bodyParser.json());
14+
app.use(bodyParser.text());
15+
16+
17+
const lessons = lessonsData;
18+
19+
20+
app.route('/lessons')
21+
.get((req, res) => {
22+
23+
var filtered = lessons;
24+
25+
if (req.query.search) {
26+
console.log(req.query.search);
27+
filtered = filtered.filter(
28+
lesson => lesson.description.indexOf(req.query.search) != - 1);
29+
}
30+
31+
res.status(200).json(filtered);
32+
})
33+
.post((req, res) => {
34+
lessons.push(req.body);
35+
res.status(200).send();
36+
});
37+
38+
app.route('/lessons/:lessonId')
39+
.delete((req,res) => {
40+
const lessonId = req.params.lessonId;
41+
console.log("deleting lesson ", lessonId);
42+
const index = _.find(lessons,
43+
lesson => lesson.id === lessonId
44+
);
45+
lessons.splice(index, 1);
46+
res.status(200).send();
47+
});
48+
49+
50+
app.route('/flakylessons')
51+
.get((req, res) => {
52+
53+
const num = Math.round(Math.random() * 10);
54+
55+
if (num % 2 == 0) {
56+
res.status(200).json(lessons);
57+
}
58+
else {
59+
res.status(500).send();
60+
}
61+
62+
});
63+
64+
65+
66+
67+
app.route('/delayedlessons')
68+
.get((req, res) => {
69+
70+
setTimeout(() => {
71+
72+
var filtered = lessons;
73+
74+
if (req.query.search) {
75+
console.log(req.query.search);
76+
filtered = filtered.filter(
77+
lesson => lesson.description.indexOf(req.query.search) != - 1);
78+
}
79+
80+
res.status(200).json(filtered);
81+
82+
}, 1000);
83+
84+
});
85+
86+
87+
function redirectRouterLessonUnmatched(req,res) {
88+
res.sendFile("index.html", { root: './src/router-introduction' });
89+
}
90+
91+
app.use(redirectRouterLessonUnmatched);
92+
93+
94+
var server = app.listen(8080, function() {
95+
console.log("Server running at http://localhost:" + server.address().port);
96+
});
97+

0 commit comments

Comments
 (0)