[英]Angularjs : Code organisation of controllers
I used the angular seed (with the file index-async.html(dependencies loaded asynchronously)) in order to start my web project, but my controllers would need some reorganisation. 我使用了角度种子(使用文件index-async.html(异步加载的依赖项))来启动我的Web项目,但我的控制器需要一些重组。 I have now 3 files full of controllers (700+ lines).
我现在有3个文件充满控制器(700多行)。 Is there an elegant way to load my controllers if I reorganize them in 10 files (and more in the future).
如果我在10个文件(以及将来更多)中重新组织它们,是否有一种优雅的方式来加载我的控制器。
Also, more files means less merging conflicts (Yeah!!!) 此外,更多文件意味着更少的合并冲突(是啊!!!)
Thx in advance Thx提前
I make extensive use of the angular.module().controller()
syntax to group my controllers by module, which has greatly improved the organization of my angular code. 我广泛使用
angular.module().controller()
语法按模块对控制器进行分组,这极大地改善了我的角度代码的组织。 As an added benefit, your controllers are no longer globally name-spaced functions. 作为额外的好处,您的控制器不再是全局名称间隔功能。
You can read more in the Module API documentation . 您可以在Module API文档中阅读更多内容 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.