-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
278 lines (233 loc) · 8.83 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Angular JS Basics</title>
<meta name="description" content="IT Survival AngularJS lecture">
<meta name="author" content="IT Survival Team">
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="base/reveal.js/css/reveal.css">
<link rel="stylesheet" href="base/reveal.js/css/theme/sky.css" id="theme">
<link rel="stylesheet" href="css/custom.css">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="base/reveal.js/lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match(/print-pdf/gi) ? 'base/reveal.js/css/print/pdf.css' : 'base/reveal.js/css/print/paper.css';
document.getElementsByTagName('head')[0].appendChild(link);
</script>
<!--[if lt IE 9]>
<script src="base/reveal.js/lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section id="start">
<h3><strong>AngularJS Basics</strong></h3>
<h2><img class="logo" src="img/AngularJS-large.png"></h2>
<p>
<small>Marek Matczak, Jarosław Fuczko, Tomasz Szewców</small>
</p>
</section>
<section id="agenda">
<h2>Agenda</h2>
<ol>
<li><a href="#/modules">Angular Modules</a></li>
<li><a href="#/dependncy-injection">Dependency Injection</a></li>
<li><a href="#/controllers">Controllers</a></li>
<li><a href="#/services-factories">Services and Factories</a></li>
<li><a href="#/useful-directives">Useful Directives</a></li>
<li><a href="#/forms">Forms</a></li>
<li><a href="#/backend-communication">Backend Communication</a></li>
<li><a href="#/tests">Tests</a></li>
</ol>
</section>
<section>
<section id="modules">
<h3>What is an Angular module?</h3>
<blockquote>
You can think of a module as a <b>container</b> for the different parts of your app – controllers, services,
filters, directives, etc.
</blockquote>
<p><small><a href="https://docs.angularjs.org/guide/module">https://docs.angularjs.org/guide/module</a></small></p>
</section>
<section>
<h3>Module definition and retrieval</h3>
<pre><code class="javascript" contenteditable data-trim>
// define a module without dependencies
angular.module('moduleName', []);
// define a module with dependencies
angular.module('moduleName', ['dependency1', 'dependency2']);
// retrieve a module
angular.module('moduleName');
</code></pre>
<pre><code class="html" contenteditable data-trim>
<!--Bootstrap application-->
<div ng-app='moduleName'></div>
</code></pre>
</section>
</section>
<section>
<section id="dependncy-injection">
<h2>Dependency Injection</h2>
<blockquote>
Dependency Injection (DI) is a software design pattern that deals with how components get hold of their dependencies.
</blockquote>
<blockquote>
The Angular injector subsystem is in charge of creating components, resolving their dependencies, and providing them to other components as requested.
</blockquote>
<p><small><a href="https://docs.angularjs.org/guide/di">https://docs.angularjs.org/guide/di</a></small></p>
</section>
<section>
<h2>Injecting dependencies</h2>
<pre><code class="javascript" contenteditable data-trim>
angular.module('moduleName').controller('SomeController', function($scope, someService){
'use strict';
// add something to injected $scope
$scope.data = {};
// call injected service method
someService.someMethod();
};
</code></pre>
</section>
</section>
<section id="controllers">
<h2>Controller recipe</h2>
<pre><code class="javascript" contenteditable data-trim>
angular.module('someModule').controller('MyFirstController', function($scope){
'use strict';
$scope.helloWorld = 'hello world!';
alert($scope.helloWorld);
});
</code></pre>
<pre><code class="html" contenteditable data-trim>
<!--use controller in the dialog template with the ng-controller directive -->
<!DOCTYPE html>
<html>
<body>
<section data-ng-controller="MyFirstController">
<h2>Hello from Dialog A!</h2>
</section>
</body>
</html>
</code></pre>
</section>
<section>
<section id="services-factories">
<h2>Service recipe (with <b>service</b>)</h2>
<pre><code class="javascript" contenteditable data-trim>
angular.module('someModule').service('myService', function(){
'use strict';
this.print = function(){
alert('hello world from a service');
};
});
</code></pre>
</section>
<section>
<h2>Service recipe (with <b>factory</b>)</h2>
<pre><code class="javascript" contenteditable data-trim>
angular.module('someModule').factory('myService2', function(){
'use strict';
var helloWorld = 'hello world from a service2';
return {
print: function(){
alert(helloWorld);
}
};
});
</code></pre>
</section>
</section>
<section>
<section id="useful-directives">
<h2>Useful built-in directives</h2>
<ul>
<li>ngModel - two way binding</li>
<li>ngBind - one way binding</li>
<li>ngClick - calling an action</li>
<li>ngRepeat - repeats the HTML element</li>
<li>ngClass - applies css classes to a HTML element</li>
<li>ngDisabled - adds the disabled attribute to a HTML element</li>
<li>ngShow / ngHide - showing / hiding HTML element</li>
<li>ngIf - removes or recreates a portion of DOM</li>
</ul>
</section>
</section>
<section>
<section id="backend-communication">
<h2>Backend communication with $http service</h2>
<pre><code class="javascript" contenteditable data-trim>
// Simple GET request example:
$http({
method: 'GET',
url: '/someUrl'
}).then(function successCallback(response) {
// this callback will be called asynchronously
// when the response is available
}, function errorCallback(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
// shortcut methods
$http.get('/someUrl', config).then(successCallback, errorCallback);
$http.post('/someUrl', data, config).then(successCallback, errorCallback);
</code></pre>
<p><small><a href="https://docs.angularjs.org/api/ng/service/$http">https://docs.angularjs.org/api/ng/service/$http</a></small></p>
</section>
<section id="backend-communication">
<h2>Response object</h2>
<ul>
<li><b>data</b> – {string|Object} – The response body transformed with the transform functions.</li>
<li><b>status</b> – {number} – HTTP status code of the response.</li>
<li><b>headers</b> – {function([headerName])} – Header getter function.</li>
<li><b>config</b> – {Object} – The configuration object that was used to generate the request.</li>
<li><b>statusText</b> – {string} – HTTP status text of the response.</li>
</ul>
<p><small><a href="https://docs.angularjs.org/api/ng/service/$http">https://docs.angularjs.org/api/ng/service/$http</a></small></p>
</section>
</section>
</div>
</div>
<script src="base/reveal.js/lib/js/head.min.js"></script>
<script src="base/reveal.js/js/reveal.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'concave', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
dependencies: [
{ src: 'base/reveal.js/lib/js/classList.js', condition: function () {
return !document.body.classList;
} },
{ src: 'base/reveal.js/plugin/markdown/marked.js', condition: function () {
return !!document.querySelector('[data-markdown]');
} },
{ src: 'base/reveal.js/plugin/markdown/markdown.js', condition: function () {
return !!document.querySelector('[data-markdown]');
} },
{ src: 'base/reveal.js/plugin/highlight/highlight.js', async: true, condition: function () {
return !!document.querySelector('pre code');
}, callback: function () {
hljs.initHighlightingOnLoad();
} },
{ src: 'base/reveal.js/plugin/zoom-js/zoom.js', async: true },
{ src: 'base/reveal.js/plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>