0

I have an angular app with a custom prefix for example myApp that generates the components selectors in this way <myApp-nav></myApp-nav>. for some reasons i need it to be <nav-myApp></nav-myApp> . another way cant go with it to add special characters to be <$-nav></$-nav> or <$myApp-nav></$myApp-nav> . i got Selector ($myApp-nav) is invalid.

Muhammed Moussa
  • 4,589
  • 33
  • 27
  • There's no *technical* requirement for a prefix, it's part of the [style guide](https://angular.io/guide/styleguide#component-custom-prefix) to avoid clashes with any other library that's providing elements which a suffix would also achieve. See https://stackoverflow.com/q/53231588/3001761 for the actual requirements. – jonrsharpe Jan 25 '21 at 15:43
  • yes looks good, I updated the question by the error I got when I use a custom prefix. – Muhammed Moussa Jan 25 '21 at 15:57
  • 1
    Your custom prefix still needs to be valid as part of a selector per the question I linked above: https://regex101.com/r/jD2H3s/1 – jonrsharpe Jan 25 '21 at 15:58
  • _"is it allowed to reverse angular component selector prefix to be a suffix?"_ Yes, you don't even need a prefix or suffix. – Thomas Sablik Jan 25 '21 at 16:01
  • yes manually, is there is a way through the cli? – Muhammed Moussa Jan 25 '21 at 16:03
  • AFAIK that's all configured in the schematics and you can create and install your own schematics. – Thomas Sablik Jan 25 '21 at 16:04

0 Answers0