Escolar Documentos
Profissional Documentos
Cultura Documentos
BY
George
Agenda
Directive Overview
Core AngularJS directives
Ng-app
Ng-controller
Ng-model
Ng-init
Interpolation Directive
Ng-bind
Ng-bind-html-unsafe
Ng-show
Ng-hide
Ng-switch
Ng-if
Ng-include
Ng-repeat
Ng-src
Ng-view
Ng-transclude
AngularJS - Directives
Ng-app Directive
Ng-controller Directive
AngularJScontrollerscontrol
AngularJS applications.
And,ng-controllerdirective defines
the controller.
Ng-model Directive
Ng-init Directive
Theng-initdirective initialize
AngularJS application variables.
Interpolation Directive
Examples:
ng-bind Directive
Examples:
ng-bind-html-unsafe :
Escaping HTML From The
Model
When the input model is HTML element,
the HTML tags are escaped before inserted
into the HTML template
Syntax:
ng-bind-html-unsafe = ModelName
Examples:
ng-show - directive
Used to show html element only when
the model condition is true
If the model condition is false, then it
wont show the HTML element in the
View
Syntax:
Examples:
ng-hide Directives
ng-switch Directive
Syntax:
ng-switch on
ng-switch-when
ng-switch-default
Example:
ng-if Directive
Theng-ifdirective can include / remove
HTML elements from the DOM
This is just like theng-switchdirective, but
it has a simpler syntax.
Here is an example:
ng-include Directive
Here is an example:
ng-repeat Directive
Theng-repeatdirective is used to
iterate over a collection of items and
generate HTML from it
Examples:
Iterate through Array:
ng-repeat Directive
Special ng-repeat
Variables
Theng-repeatdirective defines a set of
special variables which you can use when
iterating the collection.
These variables are,
$index
$first
$middle
$last
ng-repeat Directive
Ng-src Directive
Move on to Examples
Assignments #1
Create an application with the model
name of ofsTraining. And, then define
the controller in the name of
angularJSTraining
Inject the above controller & module
name into the views
Create a model name called,
traineesList in the controller And, then
dynamically display the list in the view in
the ul li tag under the attendees list
Assignments #2
In continuation with previous example,
when the user click on any one of the
trainees name, it should show the details
of the selected person the detail must
have the following, firstname,
lastname, age, yearOfExperience,
dateOfBirth, userImage. If we click on
other user, the current detail has to hide
and start display the new user details
Assignments #3
Assignments #4