A short presentation about how AngularJS can help us approach a real-world scenario. I made the presentation at the Faculty of Mathematics and Informatics, The University of Sofia
2. B.Sc. in Software Engineering at The University of
Sofia
M.Sc. in Computer Science at The University of
Copenhagen, Denmark
5+ years of professional experience
Favorite technologies
C#
JavaScript
PHP
3. jQuery is too low-level
Need to handle complex clients
MV* pattern on the client
No DOM operations
Testability
Huge community
33 439+ questions on Stack Overflow
4. Demo, demo, demo
Practical advices
Short overview of the main concepts
Some advanced techniques
5.
6. Dirty checking (used by AngularJS)
Compares a value against the previous value
Works in all browsers
Totally predictable
Change events (e.g., Knockout)
Trigger an event on every change
Can update UI before all the changes has completed
Bad performance
Has to consider dependency tracking
7. Make only async requests
Otherwise the browser hangs
Promises
Gives you a promise that you will receive a reply in the
future
Can be controlled by a deferred object
Resolve() / Reject()
Chaining of promises
One promise can change the value returned by another
promise
8. AngularJS uses modules
A LOT!
Separation of concerns
Plug and play
Dependencies between modules
9.
10.
11.
12.
13.
14. Basic structure for small applications
Can contain further folders for complex applications
15. Directives – isolate a piece of logic
Can be declared as
HTML attributes
<div hello></div>
CSS classes
<div class=“hello”></div>
HTML tags
<hello>there</hello>
16. AngularJS offers services
Can contain light domain logic
N.B. Domain logic should be on the server, exposed via
API
Relies on the data from the server
Can also be data-less
17. The glue between the controllers and the UI
Only one root scope
Many children
Children are prototypically created from the parent
scope
$rootScope.hello = ‘there’;
$childScope = prototype of $rootScope
alert($childScope.hello); // ‘there’