angular: docs: Style Guide's "Directive selectors" doesn't mention prefixing selectors

I’m submitting a…

[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see

Current behavior

In the Directive selectors section of the Style Guide, nothing is mentioned about prefixing selectors for name spacing.

However, in the Guide for Write a structural directive, in the second to last paragraph, you can find the following:

The directive attribute name should be spelled in lowerCamelCase and begin with a prefix. Don’t use ng. That prefix belongs to Angular. Pick something short that fits you or your company. In this example, the prefix is app.

This is not mentioned in the style guide. Worse, Angular’s directives seem to only be prefixed with ng when it’s a “single word” directive—ngForm—but they are not prefixed with they are multiple words—formControlName.

Expected behavior

The Style Guide should make a recommendation about prefixing or not prefixing directive attribute names. I would be more than happy to submit a PR to clarify the issue in the Style Guide once I receive direction. 👍

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (16 by maintainers)

Commits related to this issue

Most upvoted comments

I have to admit I am not sure. I would imagine that a number people (and maybe tools) link through to these styles, so perhaps the numbering should stay stable.

So if I’m understanding correctly, this is how it should be reorganized:


  • Component selectors
  • Component custom prefix
  • Directive selectors
  • Directive custom prefix


  • ~Component selector names~

In Naming, I think it makes sense for the Component section to appear before the Directive section as components are more common. Also, renaming Custom prefix for components to Component custom prefix keeps it visually connected to the preceding Component selectors.

If that sounds good I’ll submit a PR with those changes. 😄

@kapunahelewong, @shaungrady, Directives section doesn’t have Directive selector names section. If you look, Directive selectors is allocated in Naming section, thats why Component selector names can be moved to Naming section(all about naming here)

Hey @shaungrady yes! I agree completely on both points. If you have any questions about editing the files, just let me know.

@jenniferfell fyi^^ @shaungrady would like to contribute to the docs 😃

@shaungrady, @jenniferfell is our project manager for the docs and can help you navigate the process of approving and landing your PR.

@Yerkon Ohhhh, I see. It’s confusing that the bit about custom prefixes for directives doesn’t appear immediately after the Directive selectors section, but is instead bisected by the Custom prefix for components. I was also expecting that Directive selectors should cover prefixes, since prefixes are part of the selector.

Maybe Custom prefix for directives could be moved to the Directive selectors section, and Custom prefix for components could be renamed to Component selectors? Would be a bit more consistent that way.

In the Directive selectors section of the Style Guide, nothing is mentioned about prefixing selectors for name spacing.