This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
REQUEST FOR FEEDBACK: angular.component()
- default directive controller name #13664
Closed
Description
We should use a consistent default value for the name of a component's directive controller when it is attached to the scope. See #10007 (comment)
Currently we are defaulting to the canonical name of the component. This is not ideal as
a) component names can become long and unwieldy for use in a template
b) it is more complicated to automatically update the template to be used in Angular 2, where the context is the controller.
The criteria for the name are:
- it must be the same for all components
- it must start with
$
- it must be short (2-4 chars)
In addition the name should represent what is actually being published to the scope.
Some of previous suggestions include:
vm
- this is the commonly used name in many applications but the controller is not necessarily a "view model"$comp
- this is the current suggestion from the team but can be confused with compare and is not that short$ctrl
- this can be confused with input ConTRoL elements$this
- the controller is not reallythis
in the template, since the context is still actually the scope