简体   繁体   中英

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. I have now 3 files full of controllers (700+ lines). Is there an elegant way to load my controllers if I reorganize them in 10 files (and more in the future).

Also, more files means less merging conflicts (Yeah!!!)

Thx in advance

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. As an added benefit, your controllers are no longer globally name-spaced functions.

You can read more in the Module API documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM