Thursday, December 4, 2014

ANGULAR JS BY GOOGLE

AngularJS, commonly referred to as Angular, is an open-source web application framework maintained by Google and a community of individual developers and corporations to address many of the challenges encountered in developing single-page applications.

 Angular JS extends HTML with new attributes. Core Concepts : directives, expressions, templates, and data binding. AngularJS is a JavaScript framework. It is a library written in JavaScript. AngularJS is distributed as a JavaScript file, and can be added to a web page with a script tag.
 For example :

 <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>


DIRECTIVES

The ng-app directive defines an AngularJS application.

The ng-app directive tells AngularJS that the <div> element is the "owner" of an AngularJS application

The ng-model directive binds the value of HTML controls (input, select, textarea) to application data.

The ng-model directive binds the value of the input field to the application variable name

The ng-bind directive binds application data to the HTML view.

The ng-bind directive binds the innerHTML of the <p> element to the application variable name.

The ng-init directive initialize AngularJS application variables.


*You can use data-ng-, instead of ng-, if you want to make your page HTML5 valid.

EXPRESSION

AngularJS expressions are written inside double braces: {{ expression }}.

AngularJS expressions bind data to HTML the same way as the ng-bind directive.

AngularJS will "output" data exactly where the expression is written.


CONTROLLER

The ng-controller directive defines the controller.


The controller code will execute when the page loads.


Angular JS goal is to simplify both development and testing of such applications by providing a framework for client-side model–view–controller (MVC) architecture, along with components commonly used in rich internet applications.