Why ng-app not ng-module?

前端 未结 3 2169
故里飘歌
故里飘歌 2021-02-18 16:25

I understand that ng-app initializes a module in AngularJS as follows:

var app = angular.module(\'myApp\', []);

B

3条回答
  •  广开言路
    2021-02-18 17:03

    ng-app defines the main or bootstrap module of your application, which should perform the initialization task of your application. There may be case where at run time you want to decide what which should be the main module of your application. Like in java you have many methods and classes but you define one main method as starting point. Similarly, in angular you have many module, however, you define one module as the starting point of application.

提交回复
热议问题