Professional Documents
Culture Documents
AngularJS Training-Day4
AngularJS Training-Day4
By
George
Agenda
$scope Hierarchy
AngularJS $watch() , $observe, $digest() and $apply()
AngularJS Events
ng-click
ng-dbl-click
ng-mousedown
ng-mouseup
ng-mouseenter
ng-mouseleave
ng-mousemove
ng-mouseover
ng-keydown
ng-keyup
ng-keypress
ng-change
scope Hierarchy
There is a root scope, and the root scope has one or more child scopes
Each view has its own $scope (which is a child of the root scope),
so whatever variables one view controller sets on its $scope variable, those
variables are invisible to other controllers.
scope Hierarchy
$observe
Observes an interpolated attribute.
The observer is then invoked whenever
the interpolated value changes
Syntax:
$observe(key, fn);
ng-click Directive
The ngClick directive allows you to specify
custom behavior when an element is
clicked.
ng-dbl-click
The ngDblclick directive allows you to
specify custom behavior on a dblclick
event.
ngMousedown
The ngMousedown directive allows you to
specify custom behavior on mousedown
event.
ngMouseup
Specify custom behavior on mouseup
event.
ngMouseenter
Specify custom behavior on mouseenter
event.
ngMouseleave
Specify custom behavior on mouseleave
event.
ngMousemove
Specify custom behavior on mousemove
event.
ngMouseover
Specify custom behavior on mouseover
event.
ngKeydown
Specify custom behavior on keydown
event.
ngKeyup
Specify custom behavior on keyup event.
ngKeypress
Specify custom behavior on keypress
event.
ngChange
Evaluate the given expression when the user changes the input.
The ngChange expression is only evaluated when a change in the
input value causes a new value to be committed to the model.
It will not be evaluated: if the model is changed programmatically
and not by a change to the input value
Note, this directive requires ngModel to be present.
Assignments