Skip to content

Should ng generate service generate an @Service now? #33149

Description

@michael-small

Command

generate

Description

I was curious if ng generate service would generate an @Injectable or @Service when I tried in today's nightly. It generated an @Injectable({providedIn: 'root'}).

This gave me an even more curious idea: will there be a Default vs Push vs Eager change detection naming sort of moment for the ng g service command? As in, there will now be a true "service" which people will want an ng g schematic for, but what about the ol' root injectable?

I don't know if there has been any comment on if @Service will be the new default, but I wanted to get this out there for open discussion.

Describe the solution you'd like

I see two options

  • Make ng g service give a follow up prompt on choosing injectable or service.
  • Make ng g service generate an actual @Service and then create a new ng g command for injectables

Personally, I don't have strong feelings at the moment.

Describe alternatives you've considered

Manually make @Service classes myself

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions