Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Naming collisions in AngularJS definitions #2447

Closed
@brettpostin

Description

@brettpostin

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"):

<toolbar>
  <button></button>
</toolbar>

<customform>
  <button></button>
</customform>

Therefore we are again reliant on verbose naming conventions. If you include the recommended vendor prefix, you end up with something like this:

<company:toolbar>
  <company:toolbar-button></company:toolbar-button>
</company:toolbar>

<company:customform>
  <company:customform-button></company:customform-button>
</company:customform>

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions