Skip to content

Instantly share code, notes, and snippets.

@LayZeeDK
Last active November 26, 2025 07:03
Show Gist options
  • Select an option

  • Save LayZeeDK/d068ae084699b35dcdf8354d7dd829bc to your computer and use it in GitHub Desktop.

Select an option

Save LayZeeDK/d068ae084699b35dcdf8354d7dd829bc to your computer and use it in GitHub Desktop.
Ordering of Angular component class members.

Ordering of Angular component class members

Use the following order of groups to organize Angular components:

  1. Injected dependencies.
  2. Private properties.
  3. Data binding properties.
  4. View and content properties.
  5. UI properties.
  6. Component API properties.
  7. Constructor.
  8. Lifecycle hooks.
  9. Event handlers.
  10. Component API methods.
  11. Private methods.
Group Description
Component API methods Public methods intended to be used by other components, directives, or services.
Component API properties Public properties intended to be used by other components, directives, or services.
Data binding properties Properties decorated by Input/Output or initialized with input/output.
Event handlers protected methods used by the component template.
Injected dependencies Services and other dependencies resolved using inject.
Lifecycle hooks Methods implementing the AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, DoCheck OnChanges, OnDestroy, or OnInit interfaces.
Private properties Properties marked by private or #.
UI properties protected properties used by the component template.
View and content properties Properties decorated by ContentChild/ContentChildren/ViewChild/ViewChildren or initialized with contentChild/contentChildren/viewChild/viewChildren.
@Clindbergh
Copy link

@LayZeeDK thanks!

I know now of three options, though none are aware of angular specifics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment