question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fix(command/generate): directive selector should be camelcase

See original GitHub issue

Generating a directive using:

$ ng g directive my-directive

Generates a directive that looks like this:

@Directive({
  selector: 'my-directive',
  providers: [],
  host: {},

})
class MyDirective {}

There are a two things that need a fix IMO:

  1. directive selectors should be camelcase, so instead of my-directive I should get myDirective
  2. providers and host are not necessarily needed maybe we can simply remove those?
  3. If we can’t remove them, then the trailing comma and newline should be at least removed

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Broccocommented, Apr 12, 2016

If you want you can play with the branch I’m working on should have the full PR ready in the next few days

https://github.com/Brocco/angular-cli/tree/style-guide

1reaction
johnpapacommented, Apr 12, 2016

good question … not sure. mySillyDirectiveName would be ideal … but I think it is very reasonable to make it mySiLyDiRECTiveName

Read more comments on GitHub >

github_iconTop Results From Across the Web

The conflict between angular directive selector and tslint
This is the answer I got: While Angular does support class selectors for directives, this feature should be used only in special circumstances ......
Read more >
Rule: directive-selector - codelyzer
A single prefix (string) or array of prefixes (strings) which have to be used in directive selectors. kebab-case or camelCase allows you to...
Read more >
angular-in-action.pdf
from the App component code, there was a selector of app-root used to identify the component in markup. You should see the following...
Read more >
(PDF) Ngcourse | gholam reza mohammadi - Academia.edu
For directives, the selector name must be camelCase and wrapped in square brackets to specify that it is an attribute binding. We're using...
Read more >
Eclipse Jetty: Operations Guide
Enabling the postgresql module will execute the [files] directive ... you can display the JVM command line to verify that it is correct....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found