I think the main reason people prefer the mod.controller() version is
because it doesnt pollute the global namespace. In the other way, your
controllers all exist globally as functions. Polluting the global namespace
is a little taboo.

Another option is to store the controllers globally on an object, this will
namespace them and reduce the pollution to 1 variable (which you might see
as acceptable). You'll see that this is the approach for google:
http://google-styleguide.googlecode.com/svn/trunk/angularjs-google-style.html#controllers.
Note - whether you use 'controller as' here is still up to you.

heres a link on this too :
http://stackoverflow.com/questions/18734094/understanding-coding-style-in-angularjs




On 11 July 2014 03:43, Dominic Fui Dodzi-Nusenu <[email protected]> wrote:

> Hello ,
>
> I would like to know what the difference is with creating controllers
> using javascript functions and injecting services and scope into them,
> against calling them with the angularjs.module controller method?
>
> Is there an efficiency of scale issue with this? Why is the method of
> using the module now the conventional way of creating controllers?
>
> Thank you in advance.
>
> --
> 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.
>



-- 
Tony Polinelli

-- 
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.

Reply via email to