Angular ng-app directive Example
Today, We want to share with you Angular ng-app directive Example.
In this post we will show you Angular ng-app directive Example, hear for Angular ng-app directive Example we will give you demo and example for implement.
In this post, we will learn about Angular ng-app directive Example with an example.
ng-app directive : Example
Body element become(ng-app) the root element for the AngularJS app’s.
ng-app module to load with the application in AngularJS.
and it’s a optional directive.
The ng-app directive says to AngularJS that the
Syntax of The ng-app directive
[php]
…
…Something
content inside the root element for the AngularJS app’s.
…Something
…
[/php]
Example 1 : The ng-app directive
[php]
http://infinityknow.com/libs/angular.min.js
Example of The ng-app directive
[/php]
Example 2 : ng-app with App Module
[php]
http://infinityknow.com/libs/angular.min.js
Example of The ng-app directive
var app = angular.module(‘myFirstApp’, []);
[/php]
Example 3 : AngularJS Multiple ng-app within a page
[php]
http://infinityknow.com/libs/angular.min.js
Example of The ng-app directive
Your order
{{item.price | currency}}
List of username
{{_name.username}}
var purchaseCartModule = angular.module(“purchaseCart”, [])
purchaseCartModule.controller(“purchaseCartController”,
function($scope) {
$scope.items = [{
product_name: “www.infinityknow.com”,
price: 950000
}, {
product_name: “www.infinityknow.com”,
price: 890005
}, {
product_name: “www.w3free.blogspot.com”,
price: 598695
}];
$scope.remove = function(index) {
$scope.items.splice(index, 1);
}
}
);
var usernameModule = angular.module(“usernameList”, [])
usernameModule.controller(“clientnameCtrl”,
function($scope) {
$scope.username = [{
username: “Dhaval”
}, {
username: “Krunal”
}];
}
);
angular.bootstrap(document.getElementById(“Appmodule2”), [‘usernameList’]);
[/php]