I'm currently trying to organise my Angular application in such a way that it will scale appropriately to an enterprise level. However I'm finding that there seems to be an over-reliance on naming conventions within the framework, and trying to avoid naming collisions is a real issue.
For example, when defining any constants / controllers / directives / factories / filters / providers / services, a name is supplied to be implicitly used during dependency injection.
This works great with a just a few definitions. However when there could be hundreds (maybe thousands) of these definitions, trying to manage and prevent duplicates seems to be a bit of a maintenance nightmare!
Another issue is the naming of directives. As there doesn't seem to be a way to apply any context to directives, it is not possible to have something like the following (i.e. reuse the name "button"):
Therefore we are again reliant on verbose naming conventions. If you include the recommended vendor prefix, you end up with something like this:
Which I admit isn't horrific, but it highlights the reliance on naming conventions to avoid collisions.
Is there anything on the Angular roadmap to address the problem of namespacing?
I would agree that this is a must for utilizing open source angular components. Looking forward to hearing if there is a current path the angular team is taking. If not it appears that xml namespaces (though I know a number of people are allergic to them) would be the perfect way to resolve this.
That would be great feature!
It will be really useful feature.
For instance, it can help to make reusable directives/plugins which can't be included in your app without any fear of collision.
Also developers who apply http://stackoverflow.com/questions/933723/what-is-component-driven-development or http://stackoverflow.com/questions/11733267/is-package-by-feature-approach-good can do independent parts of app
+1, I'm always worried about this when I define new modules
As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.
Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.
Having checked over the release notes, I believe this is still an issue that needs attention.
For now, prefixing (either <foo-my-directive> or <foo:my-directive>) is the way to go.
Does anyone have a concrete suggestion?
There's some discussion of this in #2767.
+1 Namespacing is a basic feature, this really needs to be added.
Although namespaces would be very nice I would be happy if we could just get an exception if there is a name collision detected while parsing the controllers / directives / ...
@Nactive I'm not sure it's the solution, it may be useful in some case to override a service or directive provided by an 3rd party. But there should be at least a warning message for sure.