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.
