angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Inconsistent naming for services

Open thorstenschaefer opened this issue 10 years ago • 2 comments

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.

thorstenschaefer avatar Apr 26 '16 14:04 thorstenschaefer

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() {}
}

Brocco avatar Apr 26 '16 15:04 Brocco

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.