我有点搞不懂角度模块是如何工作的,以及使用它们的最佳方法是什么。我在一本书中读到,无论哪个模块包含服务,服务都是全局可用的。过滤器和指令显然也可以在整个应用程序的模板文件中使用。
一个简单的例子:
angular.module('main',[
'one',
'two',
'three'
]);
angular.module('one',[]).service('oneService', ...);
angular.module('two',[
// angular-module 'one' does not have to be passed here
]).controller(function(oneService){
// available here
oneService.do();
});
angular.module('three',[]);
// not a good idea
angular.module('three').service('oneService', ...);这给我带来了几个问题:
angular.module('main')和angular.mopdule('main.customers') )时,是否存在继承自动化?发布于 2014-09-13 17:31:07
Miško here在这里讨论它:
https://www.youtube.com/watch?v=ZhfUv0spHCY&t=34m19s
下面是娜奥米·布莱克的帖子:
http://blog.angularjs.org/2014/02/an-angularjs-style-guide-and-best.html
其中提到这些文件:
https://google-styleguide.googlecode.com/svn/trunk/angularjs-google-style.html https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDzdNvV6pGcuaF4Q9821Es/pub
也是最新版本的角文档州
..。我们建议您将应用程序分解为多个模块,如下所示:
摘要:
https://stackoverflow.com/questions/25825450
复制相似问题