Basic Intro
AngularJS is javascript framework, which is powerful and used for single page applications, and it's officially supported by Google.
Features
MVC Framework, AngularJS extends HTML, Scope, Controller, Services, Two Way Data-Binding, Dependency Injection, Directives, Testing.
Advantages
With AngularJS, developer write less code and get more functionality, AngularJS applications can run on all major browsers and smart phones.
- {{x}}
AngularJS Expressions
AngularJS expressions can be written inside double braces {}.
AngularJS expressions can also be written inside a directive: ng-bind="expression".
AngularJS will resolve the expression, and return the result exactly where the expression
is written.
Know we can check Total using "{'{ quantity * cost }'}"
Total in dollar: {{ quantity * cost }}
So the output name is {{ firstName + " " + lastName }}
Angular Modules.
An AngularJS module defines an application.
The module is a container for the different parts of an application.
The module is a container for the application controllers.
Controllers always belong to a module.
We can make our own Directive,Check "script.js" file for more information.
The ng-app directive initializes an AngularJS application.
The ng-init directive initializes application data.
The ng-model directive binds the value of HTML controls (input, select, textarea) to application data.
Two-way Binding
Data binding in AngularJS is the synchronization between the model and the view.
When data in the model changes, the view reflects the change, and when data in the view changes, the model is updated as well. This happens immediately and automatically,
which makes sure that the model and the view is updated at all times.
{{firstname1}}
This header will change after five seconds:
{{myHeader}}
The time is:
{{theTime}}
The $interval service runs a function every specified millisecond.
AngularJS AJAX - $http
$http is an AngularJS service for reading data from remote servers.
The AngularJS $http service makes a request to the server, and returns a response.
The server send Following Employee Name, using $http Service:
- {{x.name}}