Hi all,
I have seen some posts here and books (e.g
http://www.amazon.com/Mastering-Web-Application-Development-AngularJS/dp/1782161821)
that strongly suggest in keeping one file per module for various reasons
(e.g. issues on testing).
On the other hand i have seen some other people that like to organize their
controllers (in separate files) under the same module.
Which of the following would you choose?
*structure A*
app.js - angular.module('"GradesApp',[
GradesApp.controllers.mainControllers,
GradesApp.controllers.StudentControllers,
GradesApp.services.StudentServices] - new module
controllers/mainController.js -
angular.module('GradesApp.controllers.mainControllers',[]) - new module
controllers/StudentController.js -
angular.module('GradesApp.controllers.StudentControllers',[]) - new module
......
*or structure B*
app.js - angular.module('"GradesApp',[]) - new module
controllers/mainController.js -
angular.module('GradesApp').controller...... - reference to existing module
controllers/StudentController.js -
angular.module('GradesApp',)..controller...... reference to existing module
In big projects of course structure B could be also new module per for e.g.
GradesApp.Controllers, but mainController and studentController would refer
to the same module -> GradesApp.Controllers.
In my humble opinion structure B is much, much cleaner. It would surprise
me that a language would encourage having a lot of controller definitions
under the same file. And generally a project structure that is largely
affected by physical files.
What do you think it is the best approach?
many thanks
Spiros
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.