Hello,

I'm new to AngularJS and I'm confused about the way modules work.  I would 
expect (from other systems) that a module implementation would exist to 
prevent namespace pollution.  It might provide a way of exporting 
functions, and importing required functions from other modules.  It might 
also control the order in which modules are loaded, so that if A depends on 
B then B will be loaded before A.

With AngularJS it seems different and that makes me think I may have 
misunderstood.  As I understand it, in AngularJS you are really supposed to 
use dependency injection rather than exported symbols, and objects which 
are eligible for injection do not have any kind of namespace.  You might 
declare that module A depends on module B to make sure they get loaded in 
the right order, but that's the only reason for doing it.  You are not 
protected from situations where, for example, two modules declare a service 
with the same name.

Is my understanding correct?  If so, is there a mechanism for preventing 
these kinds of name clashes?  I'm keen to use a framework like Angular 
because otherwise, in a single page application, it's so easy to get 
clashes of this kind.  You accidentally use <div id=foo> on two views and 
suddenly one of the views stops working—and if you're unlucky it isn't the 
one you just changed. :-)

Thank you for all your work developing Angular, it looks as though it will 
be a good framework once I've figured out how it works!

Pete

-- 
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/groups/opt_out.

Reply via email to