javascript - What is the role of ng-app directive? -


i new angularjs. trying write simple angular application. wondering role of ng-app directive.

<html ng-app> 

and possible add ng-app in div tag instead of html tag? if possible, there differences between <html ng-app> , <div ng-app>, example, operating efficiency ?

the ng-app directive designates root element of application , typically placed near root element of page - e.g. on <body> or <html> tags.you can have 1 ng-app directive in html document.it used load various angularjs modules in angularjs application. angularjs framework process dom elements , child elements ng-app directive applied

usage

<div ng-app="" ng-controller="myctrl"> </div> 

or

<div ng-app="myapp" ng-controller="myctrl"> </div>  var app = angular.module('myapp', []); 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -