Ionic providers, best practices/concepts

Why is the provider folder called providers?

What are sub-categories of providers? services and factories? Anything else?

How should you name providers? For example a provider for user data.

like this: UserServiceProvider
Or like this: UserService
Or like this: UserProvider


If the angular style guide tells us to name services like: “HeroService”, then why is ionic generator producing “HeroProvider” style of names? This is utterly confusing to me.

Yes, not very convenient

I dont use the generator anyway, as for pages it makes a module per page which I dont want

I think the most inportant point is consistency and the choices you make yourself

Provider and service mean the same thing in Angular-speak. Synonyms.

Read and study the Angular style guide @Tommertom linked you to. It’s better documentation than anything Ionic currently has.

Yup… and still I find myself sometimes being confused or doubting if I am doing the right thing, amongst all the moving specifications of frameworks (see latest change on RXJS in Angular), opinions and examples…

So Aaron’s confirmation is giving me comfort (too?) being on the right track!

Why is angular and ionic using words for the same concept? If there is no reason for this they should decide on one and stick with it. This most definetively slows down communication in all organizations using their tools.

There’s no bureau of standards for hybrid development yet. If you want a monolithic set of rules, stay away from the cutting edge of software development. If you want to work in this space, get ready to do a lot of reading, and then deciding for yourself what is the right and the wrong thing to do.

Also, Ionic 4 will be less tied to Angular, so your concern here is very time-specific.

1 Like

Good point.

i guess the best practice here to optimize communication would be to decide on a set of concepts for each repo/organization.