-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
638 lines (551 loc) · 21.5 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
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Angular JS - HTML Enhanced Web Apps</title>
<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="author" content="Hakim El Hattab">
<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/theme/default.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">
<!-- Course Title -->
<section>
<h1>Angular JS</h1>
<h3>HTML Enhanced Web Apps</h3>
<p>
<small>Authored by - Vinayak Patil</small>
</p>
</section>
<!-- HEADS UP -->
<section>
<h2>Heads Up</h2>
<a href="#" class="img">
<img src="images/angular-components.png" alt="Angular Components" width="800" />
</a>
</section>
<!-- SPA -->
<section>
<section>
<h2>SPA - Single Page Applications</h2>
<a href="#" class="img">
<img src="images/spa.jpg" alt="Single Page Applications"/>
</a>
</section>
<section>
<h2>Advantages?</h2>
<ul>
<li>Makes your app as ‘snappy’ as a native app.</li>
<li>Reduces load on server.</li>
<li>More freedom to manipulate content.</li>
</ul>
</section>
<section>
<h2>Disadvantage?</h2>
<ul>
<li>Relies entirely on JavaScript.</li>
</ul>
</section>
</section>
<!-- Course Structure -->
<section>
<h2>Course Structure</h2>
<ul>
<li>Beginner</li>
<li>Intermediate to Advanced</li>
</ul>
</section>
<!-- Prerequisites -->
<section>
<h2>Course Prerequisites</h2>
<ul>
<li>HTML - Basics</li>
<li>JavaScript - Intermediate
<ul>
<li>Object Oriented Programming</li>
<li>Prototypes</li>
<li>Prototypical Inheritance</li>
<li>AJAX</li>
</ul>
</li>
</ul>
</section>
<!-- Agenda -->
<section>
<h2>Agenda: For Beginners</h2>
<ul>
<li>Why AngularJS?</li>
<li>Controllers and Scopes</li>
<li>Directives</li>
<li>Filters</li>
<li>Services</li>
<li>Modules & Routing</li>
<li>Form Validations</li>
</ul>
</section>
<!-- Why Angular JS vertical slides -->
<section>
<section>
<h2>Why AngularJS?</h2>
</section>
<section>
<h2>It's a modular Framework</h2>
</section>
<section>
<h2>Write less code</h2>
</section>
<section>
<h2>Teaches new HTML tricks</h2>
</section>
<section>
<h2>Dependency Injection</h2>
</section>
<section>
<h2>Well defined roles</h2>
<ul>
<li>DOM manipulation inside directive</li>
<li>Scope manipulation in controller</li>
<li>Reusable components as services</li>
</ul>
</section>
<section>
<h2>Unit Testing Ready</h2>
<ul>
<li>Loosely coupled components makes testing easy</li>
<li>End to End Testing like selenium</li>
<li>Cross browser and device</li>
</ul>
</section>
</section>
<!-- End of Why Angular JS vertical slides -->
<!-- How angular js works beginning -->
<!-- <section>
<section>
<h2>How does angular work ?</h2>
</section>
<section>
<a href="#">
<img src="images/mvc-working.jpg" alt="MVC working in angular">
</a>
<p>MVC big picture</p>
</section>
<section>
<a href="#">
<img src="images/databinding.png" alt="Two way data binding">
</a>
<p>Two way data binding</p>
</section>
</section> --><!-- How angular js works end -->
<!-- Controllers and Scope beginning -->
<section>
<section>
<h2>Controllers and Scope</h2>
</section>
<!-- Controllers -->
<section>
<p>Controller is defined by a JavaScript constructor function that is used to augment the Angular Scope</p>
</section>
<!-- Code snippet -->
<section>
<p>Contoller Registration</p>
<pre><code>
var myApp = angular.module('myApp',[]);
myApp.controller('GreetingController', ['$scope', function($scope) {
$scope.greeting = 'Hola!';
}]);
</code></pre>
</section>
<section>
<p>Controller Instantiation</p>
<pre><code>
<div ng-controller="GreetingController">
{{ greeting }}
</div>
</code></pre>
</section>
<!-- Scopes -->
<section>
<p>Scope is the glue between application controller and the view</p>
<a href="#" class="img">
<img src="images/concepts-databinding2.png" alt="Angular Components" width="800" />
</a>
</section>
<section>
<p>Scope Hierarchy</p>
<a href="#" class="img">
<img src="images/concepts-scope.png" alt="Scope Hierarchy" width="800" />
</a>
</section>
<section>
<p>We can create a child scope in 3 ways</p>
<ul>
<li>Child scope uses same scope as parent</li>
<li>Child scope inherits from parent scope</li>
<li>Child scope is isolated from parent</li>
</ul>
</section>
<section>
<p>Scope Events Propagation</p>
<pre><code>
angular.module('eventExample', [])
.controller('EventController', ['$scope', function($scope) {
$scope.count = 0;
$scope.$on('MyEvent', function() {
$scope.count++;
});
}]);
</code></pre>
<p>The event can be broadcasted ($broadcast) to the scope children or emitted ($emit) to scope parents.</p>
</section>
<section>
<p>Two way data-binding</p>
<a href="#" class="img">
<img src="images/Two_Way_Data_Binding.png" alt="Two_Way_Data_Binding" width="800" />
</a>
</section>
<section>
<h1>DEMO</h1>
</section>
</section><!-- Controllers and scope end -->
<!-- Using Directives Beginning -->
<section>
<section>
<h2>Using Directives</h2>
</section>
<section>
<p>A directive is how AngularJS extends HTML</p>
</section>
<section>
<pre><code>
<html ng-app>
</html>
</code></pre>
<p>A directive can be a html attribute</p>
</section>
<section>
<pre><code>
<tabs>
<pane title="Tab1">....</pane>
<pane title="Tab2">....</pane>
</tabs>
</code></pre>
<p>A directive can be a html element</p>
</section>
<section>
<pre><code>
<div class="ng-init: foo='bar'"></div>
<div ng-bind="foo"></div>
</code></pre>
<p>A directive can be a html class</p>
</section>
<section>
<h2>Built in directives</h2>
<ul>
<li>Event Directives</li>
<li>Others</li>
</ul>
</section>
<section>
<h2>Event Directives</h2>
<ul>
<li>ngClick</li>
<li>ngDblClick</li>
<li>ngMouseDown</li>
<li>ngMouseUp</li>
<li>ngMouseEnter</li>
<li>ngMouseLeave</li>
<li>ngChange</li>
<li>Others</li>
</ul>
</section>
<section>
<h2>Other Directives</h2>
<ul>
<li>ngApp</li>
<li>ngBind</li>
<li>ngModel</li>
<li>ngController</li>
<li>ngHide</li>
<li>ngShow</li>
<li>ngRepeat</li>
</ul>
</section>
<section>
<h2>Demo Directives</h2>
<iframe src="http://jsbin.com/rojuj/9/embed?html,js&height=500px" class="" id="" style="border: 1px solid rgb(170, 170, 170); width: 100%; min-height: 500px; max-height: 500px; height: 541px;"></iframe>
</section>
<section>
<h2>Can I create my own directive ?</h2>
<p class="fragment">Yes! Will see this in intermediate to Advanced course</p>
</section>
</section><!-- Using directives end -->
<!-- Using filters begin -->
<section>
<section>
<h2>Using Filters</h2>
</section>
<section>
<p>What are filters for ?</p>
<ul>
<li>Modify output</li>
<li>Formatting</li>
<li>Sorting dataset</li>
<li>Filtering dataset</li>
</ul>
</section>
<section>
<h2>How to use filter?</h2>
<pre>
<code>
{{name | filter_name}}
</code>
</pre>
</section>
<section>
<p>Built in filters</p>
<ul>
<li>uppercase/lowecase</li>
<li>number/currency/date</li>
<li>json</li>
<li>orderBy/limitTo/filter</li>
</ul>
</section>
<section>
<h2>Demo Filters</h2>
<iframe src="http://jsbin.com/taren/6/embed?html,output&height=500px" class="" id="" style="border: 1px solid rgb(170, 170, 170); width: 100%; min-height: 500px; max-height: 500px; height: 541px;"></iframe>
</section>
</section><!-- Using filters end -->
<!-- Using services beginning -->
<section>
<section>
<h2>Using Services</h2>
</section>
<section>
<h2>Dependency Injection</h2>
<p class="fragment roll-in">DI puts the AngularJS Framework to work for you.</p>
<p class="fragment roll-in">DI goes and gets the services you request so that your controllers are clearly defined and testable.</p>
</section>
<section>
<h2>Injector</h2>
<p>The injector is a service locator. There is a single injector per Angular application. The injector provides a way to look up an object instance by its name.</p>
</section>
<section>
<img src="http://docs.angularjs.org/img/guide/concepts-module-injector.png" />
<br />
<small><a href="http://docs.angularjs.org/guide">Diagram is from AngularJs.org</a></small>
</section>
<section>
<h2>Built in Services</h2>
<ul>
<li>$http</li>
<li>$resource</li>
<li>$q</li>
<li>$compile</li>
<li>$timeout</li>
<li>$exceptionHandler</li>
<li>$cacheFactory</li>
<li>$cookieStore</li>
<li>$window</li>
<li>$routeParams ...</li>
</ul>
</section>
<section>
<h2>$http</h2>
<pre><code>
function MainCtrl($scope, $http) {
$http.get('foo.json')
.then(function(res) {
$scope.items = res.data;
}, function(err) {
alert(err.message);
});
} </code></pre>
</section>
</section><!-- Using services end -->
<!-- Modules beginning -->
<section>
<section>
<h2>Modules</h2>
</section>
<section>
<h2>Application Module</h2>
<pre><code>
angular.module('App', []);
</code></pre>
<p>Calling the module method, with two parameters, initializes the module.</p>
<pre><code>
var app = angular.module('App');
</code></pre>
<p>Calling the module method, with one parameter, returns the named module.</p>
</section>
<section>
<h2>Including Modules</h2>
<pre><code>
angular.module('App', ['ngRoute']);
</code></pre>
<p>In the second parameter you can include an array of modules you would like to add to your app module.</p>
</section>
</section><!-- Modules end -->
<!-- Routing beginning -->
<section>
<section>
<h2>Routing</h2>
<pre><code>
angular.module('App', ['ngRoute'])
.config(function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'partials/home.html',
controller: 'HomeController'
})
.when('/new', {})
.when('/:id', {});
});
</code></pre>
<p>We can map a url fragment to controller and view in route configuration</p>
</section>
</section><!-- Routing end -->
<!-- Form validations beginning -->
<section>
<section>
<h2>Form Validations</h2>
<p>Angular makes validating form super simple.</p>
</section>
<section>
<h2>CSS Classes</h2>
<ul>
<li>ng-valid</li>
<li>ng-invalid</li>
<li>ng-pristine</li>
<li>ng-dirty</li>
</ul>
</section>
<section>
<h2>Binding</h2>
<ul>
<li>A form is an instance of FormController.</li>
<li>Similarly, control is an instance of NgModelController.</li>
</ul>
</section>
<section>
<h3>Steps to remember before starting validations</h3>
<ul>
<li>Add 'novalidate' attribute to your form</li>
<li>Form and input controls should have name attribute</li>
</ul>
<pre>
<code>
formName.input.property
</code>
</pre>
</section>
<section>
<h2>Adding validation rules ?</h2>
<ul>
<li>required</li>
<li>ng-minlength</li>
<li>ng-maxlength</li>
<li>ng-pattern</li>
<li>email</li>
<li>url</li>
<li>Custom validators</li>
</ul>
</section>
<section>
<h2>Usage</h2>
<pre>
<code>
feedbackForm.email.$valid
</code>
</pre>
<p>Other properties</p>
<ul>
<li>$pristine</li>
<li>$dirty</li>
<li>$invalid</li>
<li>$error</li>
</ul>
</section>
<section>
<h2>Demo</h2>
<iframe src="http://jsbin.com/qezeb/3/embed?html,output&height=500px" class="" id="" style="border: 1px solid rgb(170, 170, 170); width: 100%; min-height: 500px; max-height: 500px; height: 541px;"></iframe>
</section>
</section> <!-- Form validations end -->
<!-- Angular Seed beginning -->
<section>
<h2>Angular Seed</h2>
</section><!-- Angular seed end -->
<section>
<h1>THE END</h1>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.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,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().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;
}
}]
});
</script>
</body>
</html>