Subscribe Us

ads header

Saturday, 1 April 2017

ng-app and Binding Expressions

0
What is ng-app ?
In angular, ng-app is called a directive. The ng prefix in the directive stands for angular. The ng-app directive is a starting point of AngularJS Application. After the entire page is loaded Angular framework will first check for ng-app directive in an HTML page .Angular bootstraps itself and starts to manage the section of the page, if ng-app directive is found.

Where to place the ng-app directive on the page?
It should be placed at the root of the HTML document, that is at the [html] tag level or at the [body] tag level, so that angular can control the entire page.

Moreover you can place it on any other HTML element with in the page. When you do this only that element and it's children are managed by angular.

What are Binding expressions?
Double curly braces are called binding expressions in angular. These all are the following valid expressions in angular:
{{ 2 == 2 }} - Evaluates to true
{{ { name: 'Jenny', age : '20' }.name }} - Returns the name property value
{{ ['John', 'Jenny', 'Nenny'][1] }} - Returns the 1st element from the array
Author Image
AboutBnT

Soratemplates is a blogger resources site is a provider of high quality blogger template with premium looking layout and robust design

No comments:

Post a Comment