Capital letter for AngularJs header for controller

why, in AngularJs naming conventions, the controller name must start with an uppercase letter, while others seem to start with a lowercase letter?

+3


source to share


1 answer


It is recommended that you name your classes with an uppercase first letter to distinguish them from simple functions. Since Angular controllers are technically constructor functions that construct new controller instance objects - for consistency, it's better to reflect this fact in the name.

Injection services, on the other hand, are not constructors, they are already objects (created behind the scenes), so there is no need to name them in capital letters - they are not constructors that you (or Angular) use to create new instances of keyword objects new

.



But of course this is just a convention, not very strict. Just a nice sequence.

+1


source







All Articles