Skip to content

Inconsistent naming for services #531

Closed

Description

@thorstenschaefer

Based on the official Angular2 documentation, it seems that the standard for naming services is:
UserService, defined in class user.service.ts
If I generate a service using "ng g service user", it creates the correct file (create src/client/app/user.service.ts), but the class itself is named "User" instead of "UserService".

Is this the intention or a bug? Note that when using "ng g service UserService", the class name would be "user-service.service.ts", which doesn't seem nice either.

Activity

  1. self-assigned this
    on Apr 26, 2016
  2. added this to the milestone on Apr 26, 2016
  3. Brocco commented on Apr 26, 2016

    @Brocco
    Contributor

    Good catch, we will update blueprint to handle this command

    ng generate service user

    to generate this code (whitespace removed for brevity):

    import {Injectable} from 'angular2/core';
    @Injectable()
    export class UserService {
      constructor() {}
    }
  4. added 3 commits that reference this issue on Apr 26, 2016
    30bba97
    f6bf490
    391e72b
  5. added a commit that references this issue on Apr 26, 2016
    49fc1f8
  6. angular-automatic-lock-bot commented on Sep 5, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  7. locked and limited conversation to collaborators on Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions