Then I get the module: angular.module('myApp', []); var mod = angular.module('...">

Angular.module name by default

When

<html ng-app="myApp"> 

Then I get the module:

angular.module('myApp', []); 
var mod = angular.module('myApp')
mod.controller('MyController',
function ($scope) {})

I am wondering how to choose the default module when <html ng-app>

+4
source share
2 answers

From viewing AngularJS source code. I can only guess that the default name for the module is ng-appeither simple app, or ngAppor ng-app. You need to try these three to see which one works.


The directive is ng-appused to create a module via HTML. If there are no directives in HTML np-app, then you need to assign the DOM module with angular.bootstrap. Without a module, an AgularJS application will not work.

ng-app . AngularJS HTML.

<html ng-app>. , AngularJS JS-. , .

(, ), .

, .

+2

myApp , .

0

All Articles