AngularJS : Controller As and the vm Variable
From AngularJS 1.2 onwards, the “Controller As” syntax was introduced.
This principle makes the controller code creation more readable.
Essentially we are assigning “this” to the variable “vm” and attaching properties and behaviour to this created “vm” object.
Of course we can use another name than “vm” in the “Controller As” syntax.
Under the hood, Angular creates the $scope object and attaches the properties and behaviour.
However by using the “Controller As” syntax, the code remains clean from controller level and only the alias name is visible on view level.
There are no direct advantages or disadvantages in using the “$scope” or the “Controller As” approach.