Angular Member Sequence Standards · NG-02
Methods and properties must be grouped · NG-02.1 · MUST
@Input()
@Output()
@ViewChild()
@ViewChildren()
Properties
@HostListener()
Setters/Getters
Constructor
Angular lifecycle hooks
Private methods
Protected methods
Public methodsThis could be extended by grouping everything either side of the contructor into regions based on what part of the component they are for. Leaving the Angular lifecycle methods in between the constructor and the methods for the component.
// Componenent/directive/pipe functionality 1
@Input()
@Output()
@ViewChild()
@ViewChildren()
Properties
@HostListener()
Setters/Getters
// Componenent/directive/pipe functionality 2
@Input()
@Output()
@ViewChild()
@ViewChildren()
Properties
@HostListener()
Setters/Getters
...
Constructor
Angular lifecycle hooks
// Componenent/directive/pipe functionality 1
Private methods
Protected methods
Public methods
// Componenent/directive/pipe functionality 2
Private methods
Protected methods
Public methods
...