Yeah, I have a *ton* of submodule defines in the main app's injection block. Not the end of the world, but I sure do wish there was an easier way. I'm currently at (just counted) 34 such definitions. Perhaps overkill, but OTOH I know exactly where everything goes in terms of filesystem.
e On Fri, May 23, 2014 at 10:48 AM, Michael Cranston < [email protected]> wrote: > hey Eric, > > Yeah I tend to agree. Having a variable 'my-app' or whatever just seems to > encourage spreading it everywhere. > > In your app.js, do you end up with a lot of sub-module deifnitions? > > in your case: > > angular.module('app', [ 'app.datamodel', 'app.pages.people', etc etc ]); > > in a large scale app, wouldn't you begin to have many submodules? > > On Friday, 23 May 2014 13:37:06 UTC-4, Eric Eslinger wrote: > >> I prefer the non-variable way, because it discourages spreading your >> module across many files. There doesn't seem to be much use to it anyway if >> you enclose it in a self executing closure. >> >> So in one file I have angular.module('app').config ...blabla >> and in another file I have angular.module('app.datamodel') >> and in another I have angular.module('app.pages.people') and so on. >> >> The dependencies get passed around by the injector, as I understand it, >> so the 'whatever' service would only have the enjected dependencies if it >> was defined as .service('whatever', function(dep1, dep2) {...}) >> >> e >> >> >> On Fri, May 23, 2014 at 10:11 AM, Michael Cranston <cranston.mi...@ >> gmail.com> wrote: >> >>> Thanks for the response. >>> >>> So does either approach have an advantage over the other? Other than the >>> fact that a global app variable is now created. >>> >>> On Friday, 23 May 2014 13:06:06 UTC-4, Raul Vieira wrote: >>> >>>> In the first case you’re creating a global variable. However, you can >>>> address wrapping it in a seaf. >>>> >>>> The issue with the latter is changing ‘app’ to ‘my-app’ would have to >>>> be done through out the file. >>>> >>>> I tend to use the first approach. >>>> >>>> Raul >>>> >>>> On May 23, 2014, at 1:01 PM, Michael Cranston <[email protected]> >>>> wrote: >>>> >>>> I have seen: >>>> >>>> <pre> >>>> var app = angular.module('app', [ 'dependendcy1', 'dependendcy2' >>>> , 'dependendcy3', 'dependendcy4' ]); >>>> app.config(function() { ... }); >>>> app.service('whatever' function() { ... }); >>>> app.filter('whatever' function() { ... }); >>>> etc >>>> </pre> >>>> >>>> I have seen: >>>> >>>> <pre> >>>> angular.module('app', [ 'dependendcy1', 'dependendcy2' >>>> , 'dependendcy3', 'dependendcy4' ]) >>>> .config(function() { ... }); >>>> >>>> angular.module('app').service('whatever' function() { ... }); >>>> angular.module('app').filter('whatever' function() { ... }); >>>> </pre> >>>> >>>> >>>> Are there advantages or disadvantages of either approach? In approach >>>> #1, does the "whatever" filter get all of those dependencies even though it >>>> doesn't need them? Or is this even an issue? >>>> >>>> -- >>>> 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. >>>> >>>> >>>> -- >>> 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. >>> >> >> -- > 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. > -- 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.
