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]<javascript:>> > 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] <javascript:>. > To post to this group, send email to [email protected] <javascript:> > . > 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.
