【问题标题】:How does angularjs know to lookup the modules?angularjs 如何知道查找模块?
【发布时间】:2015-01-08 18:45:57
【问题描述】:

我正在查看这个开源项目赏金来源的 angularjs 应用程序。

我需要澄清一下:

  1. angular.js 如何知道在哪里查找模块?

    angular.module('常量', []); angular.module('过滤器', []); angular.module('directives', []); angular.module('服务', []); angular.module('工厂', []); angular.module('资源', []); angular.module('bountysource', ['constants', 'services', 'directives', 'filters', 'factories', 'resources']);

    angular.module('activity', ['bountysource']); angular.module('fundraisers', ['bountysource']); angular.module('teams', ['bountysource']);

https://github.com/bountysource/frontend/blob/master/src/app/app.js#L29

模块常量、过滤器等在 /src/common 文件夹中

  1. 我只看到 app.js 文件中定义的主 AppController,其他控制器如何加载或有约定?

https://github.com/bountysource/frontend/blob/master/src/app/app.js#L69

不仅是控制器,还有 routes.js 文件呢?

或者当项目使用 gruntjs 构建时,这一切都只是 b/c 工作,它将所有这些合并到一个文件中?

【问题讨论】:

  • 我没有看源码,但是他们的构建系统可能将js文件连接在一起并将新文件注入到html中。

标签: angularjs


【解决方案1】:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多