Angular JS1
Angular JS1
AngularJS - Directives
AngularJS directives are used to extend HTML. These
are special attributes starting with ng- prefix.
ng-app This directive starts an AngularJS Application.
ng-init This directive initializes application data.
ng-model This directive binds the values of
AngularJS application data to HTML input controls.
ng-repeat This directive repeats html elements for
each item in a collection.
ng-init
ng-init directive initializes an AngularJS Application data. It is
used to put values to the variables to be used in the
application.
AngularJS - Expressions
Expressions are used to bind application data to html.
Expressions are written inside double braces like {{
expression}}. Expressions behaves in same way as ng-
bind directives. AngularJS application expressions are
pure javascript expressions and outputs the data where
they are used.
<p>Hello {{student.firstname + " " +
student.lastname}}!</p>
AngularJS - Filters
Filters are used to change modify the data and can be
clubbed in expression or directives using pipe character.
AngularJS - HTML DOM
Following directives can be used to bind application data to
attributes of HTML DOM Elements.
AngularJS - Forms
AngularJS enriches form filling and validation. We can
use ng-click to handle AngularJS click on button and use
$dirty and $invalid flags to do the validations
Use novalidate with a form declaration to disable any
browser specific validation. Forms controls makes heavy
use of Angular events.
Events
AngularJS provides multiple events which can be associated with the
HTML controls.
Validate data
Following can be used to track error.
$dirty states that value has been changed.
$invalid states that value entered is invalid.
$error states the exact error.
AngularJS - Ajax