Angular JS - 如何提及模块依赖?

Angular JS -How to mention module dependencies?

我刚开始学习 Angular JS 框架,我有一个非常奇怪的疑问:)

例如,在您命名模块后 - moduleName 而这个 moduleName 取决于 - anotherModule

然后,你写:

   var myCoolApp = angular.module('moduleName', ['anotherModule']);

但是如果anotherModule依赖于anotherAwesomeModule,我应该写成:

   var myCoolApp = angular.module('moduleName', ['anotherModule', 'anotherAwesomeModule'])

还是它会自己照顾自己??我在想..

这个

angular.module('anotherModule', ['anotherAwesomeModule']);
angular.module('moduleName', ['anotherModule']);

会起作用。

这是一件好事

angular.module('anotherModule', ['anotherAwesomeModule']);
angular.module('moduleName', ['anotherModule', 'anotherAwesomeModule']);

如果moduleName本身依赖于anotherAwesomeModule。即使 anotherModule 停止依赖它,代码仍然按预期工作。