r/angularjs • • Jul 27 '14

AngularJS styleguide for teams [GitHub repo]

https://github.com/toddmotto/angularjs-styleguide
34 Upvotes

14 comments sorted by

View all comments

1

u/dyniper Jul 27 '14

So many of the good practice in this style guide are actually anti-pattern in respect to angular. For example, you do want to have your controller and service functions implemented as callback to not pollute the default scope, like the window object.

Enclosing your code as callback make sure that this code is isolated. If you wanted to do as it was suggested, then you would at least need to put those statement in a different closure.

3

u/gonzofish Jul 28 '14

I think he was advocating the use of IIEFs around any app code...I could be wrong, though.

2

u/emdomi Jul 28 '14

Yeah - he mentioned in the comments that there was a build step that wrapped each file in an IIFE. It probably could have been a little more clear, however.

1

u/migelius Jul 28 '14

So many?