AJS - Directives ng-app
ng-app directive से AngularJS Application की शुरुआत होती है | ये Application का root element होता है | ये AngularJS को automatically initialize करता है |
HTML Document पर सिर्फ एक ही ng-app directive होती है | अगर एक से ज्यादा ng-app directives होती है तब HTML Document के पहले ही
Syntax for ng-app Directive in AngularJS
<html|body|div ng-app=""> --------- </html|body|div> <html|body|div ng-app="myapp"> --------- </html|body|div>
ng-app Attribute's Parameters in AngularJS
ng-app = "" : ng-app attribute की value; optional है | value पर module name दिया जाता है |
Example for ng-app Directive in AngularJS
Source Code :Output :<html> <head> <script src="angularjs.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> </head> <body> <div ng-app = ""> Enter Name: <input type = "text" ng-model = "name"><br /> Hiii ! <span ng-bind = "name"></span><br /> </div> </body> </html>
Enter Name:
Hiii !
Hiii !