[Fixed] How should I name a plain class (and its file) in Angular?

Issue

What’s the convention to name a simple class (and its file) in Angular?

Let’s say I have to create a class call Utility. Of course I can’t name it UtilityComponent (utility.component.ts) or UtilityService (utility.service.ts), ecc.

Is it correct to name the class just Utility and the file utility.ts?

Thank you

Solution

Yes thats a good naming. You can make an extra folder, name it e.g. "Utilities", then put the file utility.ts in there.

Leave a Reply

(*) Required, Your email will not be published