Closed dkarigithu closed 10 years ago
Here is Home module https://github.com/StarterSquad/angularjs-requirejs-seed/tree/develop/source/js/modules/home
There are:
That I've seen already modified & got it integrated with an app I'd previously built challenge is when I try inject external services it fails to evaluate. I noticed instead on declaring 'angular.module' you used 'controllers'??
On Wed, Mar 26, 2014 at 2:24 PM, Max Diachenko notifications@github.comwrote:
Here is Home module https://github.com/StarterSquad/angularjs-requirejs-seed/tree/develop/source/js/modules/home
There are:
- Controller
- Template
- Tests (e2e, CoffeeScript unit-test, pure-JS uit-test (choose whatever you want))
- Service files - index.js and module.js
Reply to this email directly or view it on GitHubhttps://github.com/StarterSquad/angularjs-requirejs-seed/issues/21#issuecomment-38672635 .
Regards, David Karigithu
Cell: 0722709972 Skype: d.karigithu
Hi David. Yeah, variable name controllers stayed here from old versions of seed where we had modules by types: controllers, services etc. Not so long ago I've changed these variables to "module" - that's what it actually means
And yeah, answer to the cause of your question. Controllers was obtained as requirejs dependency from controllers module definition file. For illustration see HomeCtrl and its way to use module.js that is defined in the same folder
I thought the same applied to directives which after realising I configured them to work like 'app.constants'. The comment in 'module.js':
Attach controllers to this module if you get 'unknown {x}Provider' errors from angular, be sure they are properly referenced in one of the module dependencies in the array. Below, you can see we bring in our services and constants modules which avails each controller of, for example, the config
constants object.
Does this mean if I want to inject the '$state' service I'll need to define the 'ui.router' module as a dependency in the controller?
Injections of other modules happen on module definition step. In our setup it's in module.js
files under each module. E.g. see how ui.router is injected in the home module in bare seed.
Don't understand where the 'controllers' object comes from. Can't find anywhere it is instantiated?