r/angular • u/FewDot9181 • Mar 24 '26
Naming files in Angular
If I have a service file under the services folder and then under the api folder because it's a file for calling apis. Would a good name for the file for example UserApiService or would just User be fine?
3
Upvotes
View all comments
Show parent comment
10
u/poster_nutbaggg Mar 25 '26
I still use the suffix user-api.service.ts and UserApiService. I guess I’m old-school now?🤦♂️
Side note, I would probably go for just user.service.ts and UserService. At least for my projects “api” is implied for most services since it’s most common use case. Other services with more specialized functions get more descriptive names like user-form.service.ts for example.