Yuriy Dyachkov
Yuriy Dyachkov

Reputation: 449

Why add Controller suffix in angular user controllers?

As my limited experience in Angular tells me, there is no such a case, when the controller identifier string may have a collision with another angular entity's identifier (service name, filter name, directive name, etc.).

When we use the controller identifier string? Only when declaring a controller for some element, using the ngController directive, and when defining the controller's constructor in javascript, using module.controller(...) method.

Also we can store controller names in an array or map, etc. and manipulate them in some fashion to implement dynamic or inherited controllers, or anything needed by our app architecture.

But anyway, if I use controller name as a string literal or as a variable, I always know, that I refer to angular entity controller. So, why always add 'Controller' suffix to angular controller names? Can I throw that suffix away or there can be related naming issues in the future ?

Upvotes: 1

Views: 921

Answers (1)

Chris Hermut
Chris Hermut

Reputation: 1758

That suffix is only a naming convention so you can use whatever string you want.

The only requirement is to have first character lowercase.

Ref: https://github.com/mgechev/angularjs-style-guide#modules

Upvotes: 2

Related Questions