Structuring my AngularJS application

后端 未结 5 1738
旧巷少年郎
旧巷少年郎 2021-01-30 10:57

I\'m totally newbie at using AngularJs and although I\'ve been through the tutorials, I still have loads of unanswered questions in my mind. My main concern right now is how sho

5条回答
  •  执念已碎
    2021-01-30 11:49

    Sam's method seems to be the way to go in most cases. The current Angular documentation has it setup as a module for each controller, service, etc, but this has been contradicted by Miško himself from google.

    In a recent Angularjs Best Practices video by Miško, he shows how the structure of modules could be laid out for ease of testing as well as easy scaling. Keep in mind how you structure the modules is not supposed to affect performance within an angular app.

    From developing angular apps, I would suggest using the best practices method for the aforementioned reasons. You may wish to make your own node script to generate your controllers, etc for the time being which could include say the module you wish to create the controller in and the name, which would then auto generate your controller and proper test spec creation.

    If you want a great read on the setup there is an excellent post here regarding setting up the project based on where you think it will be heading.

提交回复
热议问题