Closed jonahkagan closed 11 years ago
I wasn't aware that specifying the controller in routes didn't work with is technique. The more traditional syntax, probably will be less confusing as well, at the cost of added typing.
This does bring up another question. How do you feel about having all of the controllers in one file?
scripts /
controllers.coffee
vs
scripts /
controllers /
user.coffee
I'm just starting to hit this problem as my controllers file gets larger. However, I've decided to leave them all in one file as motivation to factor out more functionality into services.
(big generalization warning) I think anybody who gets to the point where they'll want their controllers in different files will have a good enough understanding of things by that point to do it themselves.
Jonah
On Sun, Aug 19, 2012 at 12:53 PM, Kyle Finley notifications@github.comwrote:
I wasn't aware that specifying the controller in routes didn't work with is technique. The more traditional syntax, probably will be less confusing as well, at the cost of added typing.
This does bring up another question. How do you feel about having all of the controllers in one file?
scripts / controllers.coffee
vs
scripts / controllers / user.coffee
— Reply to this email directly or view it on GitHubhttps://github.com/scotch/angular-brunch-seed/issues/5#issuecomment-7854661.
Your probably right.
Since we're removing the mod = {}
from controllers.coffee
I think it should be removed from the services.coffee
and directives.coffee
, too in the name of consistency. If you have alright started on this, please do send a pull request, otherwise I can make the change.
Oh, and if you do send a pull request please add your name to the CONTRIBUTORS.md
and AUTHORS.md
files.
Fixed with 631317113978d4fa0caa704031102d4841ac81ec @jonahkagan thank you.
Right now we have something like:
If we want to associate a controller with a route, we want to write something like:
When I tried it, I couldn't get it to work unless I set the
name
attribute on the scope of the controller (as opposed toTitle
. With a little restructuring, however, you only need to name the controller once. It looks like this:Let me know what you think of this change and I'll submit a pull request.