3. FACTS
100% Javascript and 100% Client Side
It is a framework not a library
Won't make your application look better
Alternatives: EmberJS and Backbone
MVC Pattern
4. UNDER THE HOOD
Routing
Caching
History
*Dependency Injection
Data Binding
Templating
Timing
Compiling
7. TERMINOLOGY
Model - application data
$scope - the bridge between application data, view and
controller
View - what the user sees
Template - blueprints for the view
Controller - application behavior
Directive - reusable component
Module - how the application is bootstrapped
9. SCOPE
IN THE $SCOPE YOU STORE EVERYTHING THAT YOU NEED TO
DISPLAY ON THE VIEW OR YOU NEED TO CALL FROM THE VIEW
10. SCOPE VIEW
THE SCOPE HAS A HIERARCHICAL STRUCTURE TO MIMIC THE DOM AND CAN INHERIT FROM
PARENT SCOPES. ALSO CAN PASS EVENTS TO PARENT OR CHILD SCOPES.
21. WATCHERS
For each binding a $watcher is stored
Each digest cycle is checking all the watchers
If the value was changed then the watcher callback is executed
The digest is executed multiple times *
24. CONTROLLERS
PROVIDES A WORKBENCH WHERE YOU CAN DEFINE
PROPERTIES OR FUNCTIONS ACESSIBLE FROM THE VIEW
HAS ACESS TO $SCOPE, AND INJECTABLES
25. DIRECTIVES
DEFINES THE BEHAVIOR FOR REUSABLE COMPONENTS
A DIRECTIVE IS NEEDED ONCE YOU NEED TO ACESS THE DOM
ELEMENT
26. SERVICES
SINGLETON OBJECTS THAT CARRY OUT SPECIFIC TASKS
SERVICE OBJECTS ARE INJECTABLE IN THE CONSTRUCTOR
PERSISTED STATE BETWEEN PAGE NAVIGATION
27. FILTERS
COMPONENT PROVIDERS USED TO FORMAT DATA
USED IN VIEWS IN ORDER NOT TO INCLUDE LOGIC IN THE
CONTROLLER
EXAMPLE: DATE FORMATTER, CURRENCY ETC.
36. RESTRICT
This simply restricts the way you can define a directive. As we’ve
seen before, we can restrict it as:
E: elements
A: attributes
C: class names (CSS)
M: comments
40. TRANSCLUDE
Prevents from replacing element contents and inserts the
content where ng-transclude directive can be found
41. SCOPE
false - Is the default option which does not create a new scope
for a directive but shares the scope with its parent.
true - Creates a new scope but prototypically inherits from the
parent scope.
'isolate' - Creates an isolated scope which does not
prototypically inherit from the parent
@ – binds the value of parent scope property (which always
a string) to the local scope. So the value you want to pass in
should be wrapped in {{}}. Remember `a` in braces.
= – binds parent scope property directly which will be
evaluated before being passed in.
& – binds an expression or method which will be executed in
the context of the scope it belongs.
42. CONTROLLER
This can be treated as a control room for a directive. You can
either bind properties/methods to $scope available or this
keyword.
43. COMPILE
This is the place where you can do the DOM manipulation.
44. LINK
Its job is to bind a scope with a DOM resulted in a 2-way data
binding. You have access to scope here unlike compile function
so that you can create custom listeners using $watch method.