In my application directory, I have the following structure:
scripts/
modules/
module1/
controllers/
MainController.js
module2/
controllers/
MainController.js
main.js
I am looking to organize the controllers in each module into their own namespace. For example:
module1.MainController
module2.MainController
This way, when using the ng-controller="MainController"
directive in HTML, it will know which module to serve it from. Additionally, I would like the modules to be able to communicate with each other.
Please provide guidance on the best way to achieve this and whether it is possible at all?
I came across something similar here: http://jsfiddle.net/luisperezphd/j5jzsppv/ but I'm unsure if this is a good solution. It utilizes angular.ng-modules.js.
EDIT: I am working with Angular.js v.1.3.6. There were no issues regarding namespaces on version 1.2.x.