-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
467 lines (398 loc) · 13.1 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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Building Kickass SPAs with AngularJS | CodeCamp '13</title>
<meta name="author" content="Marko Ilievski">
<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">
<link rel="stylesheet" href="css/reveal.min.css">
<link rel="stylesheet" href="css/simple.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
<script src="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 data-background="images/start-slide.jpg" data-background-size="contain"></section>
<section>
<h2>Building Kickass SPAs<br />with AngularJS</h2>
<br />
<p>
<strong>Marko Ilievski</strong><br />
Sr. Software Engineer, Netchex<br /><br />
<a href="https://github.com/shizik/" target="_blank">github.com/shizik</a><br />
<a href="https://github.com/wcpro/ScaffR" target="_blank">github.com/wcpro/ScaffR</a>
</p>
</section>
<section data-background="images/mobile.jpg" data-background-size="contain"></section>
<section data-background="images/sponsors.png" data-background-size="contain"></section>
<section>
<p>What is a SPA anyway?</p><br />
<div class="fragment">
<p>Web app providing</p>
<p class="fragment grow"><strong>rich and fluid UX</strong></p>
<p>by loading and executing code</p>
<p>within a single page</p>
</div>
</section>
<section data-background="images/gmail-screenshot.png" data-background-size="contain"></section>
<section>
<p>What's wrong with jQuery?</p>
<p class="fragment"><strong>It's imperative :(</strong></p>
<div class="fragment">
<pre>
<code><label>Name:</label>
<input type="text" id="name" />
<p id="greeting"></p></code></pre>
<div class="ng-example">
<label>Name:</label>
<input type="text" ng-model="example1" />
<p>Hello {{ example1 }}!</p>
</div>
</div>
<pre class="fragment">
<code><script type="text/javascript">
$(function () {
var $name = $('#name');
var $greeting = $('#greeting');
$name.keyup(function () {
$greeting.text('Hello '+ $name.val() + '!');
})
})
</script></code></pre>
</section>
<section>
<section>
<p>Lets see AngularJS?</p>
<div class="fragment">
<pre>
<code><label>Name:</label>
<input type="text" ng-model="name" />
<p>Hello {{name}}!</p></code></pre>
<br />
<div class="ng-example">
<label>Name:</label>
<input type="text" ng-model="example2" />
<p>Hello {{ example2 }}!</p>
</div>
</div>
</section>
<section>
<h1>Declarative!</h1>
</section>
</section>
<section class="ng-example" ng-init="message='Hello Campers!'">
<h3>Data Binding</h3>
<h3>HTML/DOM ⇔ JavaScript</h3>
<div style="overflow:hidden">
<div style="float:left; padding-left:100px; width:400px;">
<pre style="box-shadow:none;"><input
ng-model="model.message"
value="{{ message }}" /></pre>
<br />
<input type="text" ng-model="message" />
</div>
<div style="float:right; width:400px;">
<pre style="box-shadow:none;">$scope.model = {
message: "{{ message }}"
};</pre>
<br />
<pre class="fragment" style="box-shadow:none;" ng-click="message='Hello there!'">$scope.model.message = "Hello there!"</pre>
</div>
</div>
<br />
<h3 class="fragment"><strong>Dirty checking</strong></h3>
</section>
<section>
<p>
Render<br />↓<br />Render<br />↓<br />Render<br />↓<br />Render<br />↓<br />Render<br />↓<br />$apply
</p>
</section>
<section data-transition="linear">
<h3>Is that it?!?</h3>
<div class="fragment">
<h3>Nope. There is a lot more going on:</h3>
<ul>
<li>Data Binding</li>
<li>Views</li>
<li>Templates</li>
<li>Routing and Deep Linking</li>
<li>Pub/Sub</li>
<li>Dependency Injection</li>
<li>MV*</li>
<li>...</li>
</ul>
</div>
</section>
<section data-transition="linear">
<img src="images/jackie-chan-meme.jpg" />
</section>
<section data-transition="fade">
<h2>Full Featured Framework!</h2>
<img style="border:none;box-shadow:none;" src="images/angular-logo.png" />
</section>
<section>
<p>There are other frameworks, why Angular?!?</p>
<br />
<p class="fragment">Well...</p>
<br />
<blockquote class="fragment" cite="http://www.sitepoint.com/10-reasons-use-angularjs/">
“Angular is the only framework that doesn’t make MVC seem like putting lipstick on a pig.”
</blockquote>
</section>
<section>
<img src="images/pig-lipstick.jpg" />
</section>
<section>
<img src="images/angular-components.png" />
</section>
<section>
<section>
<h3>Everything is a Directive</h3>
<pre><code>
<!DOCTYPE html>
<html ng-app>
<head>
<title></title>
</head>
<body>
<div>
Name: <input type="text" ng-model="name" />
<p>The name is: <span ng-bind="name"></span></p>
</div>
<script src="Scripts/angular.js"></script>
</body>
</html>
</code></pre>
</section>
<section>
<pre><code><p>The name is: <span ng-bind="name"></span></p></code></pre>
<br />
<p>You should use handlebars instead of <strong>ng-bind</strong></p>
<br />
<pre><code><p>The name is: {{ name }}</p></code></pre>
<br />
<p>And get much cleaner templates</p>
</section>
</section>
<section>
<pre><code>
<div ng-init="names=['Angular','Ember','Knockout']">
<p>Looping with the ng-repeat Directive</p>
<ul>
<li ng-repeat="name in names">{{ name }}</li>
</ul>
</div>
</code></pre>
<hr />
<div class="ng-example"
ng-init="names=['Angular','Ember','Knockout']">
<p>Looping with the ng-repeat Directive</p>
<ul>
<li ng-repeat="name in names">{{ name }}</li>
</ul>
</div>
</section>
<section>
<p>Imagine teaching the HTML new tricks</p>
<br />
<p class="fragment">Well you <strong>can!</strong> By using directives!</p>
<br />
<p class="fragment">More on that later...</p>
</section>
<section>
<section>
<pre><code class="html xml">
<div ng-controller="MyController">
Your name:
<input type="text" ng-model="username">
<button ng-click='sayHello()'>greet</button>
<p>{{greeting}}</p>
</div>
</code></pre>
<h3 class="fragment">View ← <code><strong>$scope</code></strong> → Controller</h3>
<pre><code>
<script type="text/javascript">
function MyController($scope) {
$scope.username = 'World';
$scope.sayHello = function() {
$scope.greeting = 'Hello ' + $scope.username + '!';
};
}
</script>
</code></pre>
</section>
<section class="ng-example">
<div ng-controller="MyController">
Your name:
<input type="text" ng-model="username">
<button ng-click="sayHello()">Greet</button>
<p>{{greeting}}</p>
</div>
</section>
</section>
<section data-transition="fade">
<img src="images/angular-stack.png" />
</section>
<section data-transition="fade">
<pre><code><html ng-app="moduleName"></code></pre>
<img src="images/angular-module.png" />
</section>
<section>
<h3>Defining a Module</h3>
<pre><code class="javascript">
var myModule = angular.module('myModule', []);
// add some controllers and services
myModule.controller('myController', ...);
myModule.service('myService', ...);
// Add provider configuration (route provider for example)
myModule.config(function(){...});
// Add service configuration
myModule.run(function(){...});
</code></pre>
</section>
<section>
<h3>Defining Routes</h3>
<pre><code class="javascript">
var myModule = angular.module('myModule', ['ngRoute']);
myModule.config(function ($routeProvider) {
$routeProvider
.when('/',
{
controller: 'indexController',
templateUrl:'index.html'
})
.when('/details',
{
controller: 'detailsController',
templateUrl:'details.html'
})
.otherwise({ redirectTo: '/' });
});
</code></pre>
</section>
<section>
<h3>Where are these views rendered?</h3>
<div class="fragment">
<pre><code class="html"><div ng-view></div></code></pre>
<p>or</p>
<pre><code class="html"><ng-view></ng-view></code></pre>
</div>
</section>
<section>
<h3>Defining Services</h3>
<pre><code class="javascript">
var myModule = angular.module('myModule');
myModule.factory('customerService', function() {
var newServiceInstance = {};
var customers = [ ... ];
newServiceInstance.getCustomers = function () {
return customers;
};
return newServiceInstance;
});
</code></pre>
</section>
<section>
<h3>Injecting Services</h3>
<pre><code class="javascript">
var myModule = angular.module('myModule');
myModule.controller('customerCtrl', function($scope, customerService) {
$scope.customerList = customerService.getCustomers();
// do stuff with the list
});
</code></pre>
</section>
<section>
<h2>Factory vs Service vs Provider</h2>
</section>
<section>
<h1>Live Coding</h1>
<p>Putting it all together</p>
</section>
<section>
<h2>Important!</h2>
<br />
<p>Be careful when using <strong><code>$apply</code></strong></p>
<pre><code class="javascript">
// Bad
$scope.message = "Yo!";
$scope.$apply();
//Good
$scope.$apply(function() {
$scope.message = "Yo!";
});
</code></pre>
</section>
<section>
<p><strong>Tools</strong><br />
Batarang | Yeoman | Karma</p>
<br />
<p><strong>UI Components</strong><br />
AngularUI | KendoUI | Wijmo</p>
<br />
<p><strong>Libraries</strong><br />
BreezeJS | Firebase</p>
<br />
<p><strong>Good place to start</strong><br />
<a target="_blank" href="http://docs.angularjs.org/guide/">http://docs.angularjs.org/guide/</a></p>
</section>
<section>
<h2>Questions?</h2>
<ul>
<li>Complete electronic evaluation forms on the computers in the hall and enter to win!!</li>
<ul>
<li>Infragistics Ultimate</li>
<li>Telerik DevCraft</li>
<li>JetBrains .NET tools</li>
<li>Semos training vouchers</li>
<li>Pluralsight subscriptions</li>
<li>and many more...</li>
</ul>
</ul>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.js"></script>
<script src="js/angular.min.js"></script>
<script src="js/examples.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
slideNumber: true,
transition: 'default', // default/cube/page/concave/zoom/linear/fade/none
// Parallax scrolling
// parallaxBackgroundImage: 'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg',
// parallaxBackgroundSize: '2100px 900px',
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
Reveal.addEventListener( 'customevent', function() {
alert("Hey there");
});
</script>
</body>
</html>