← Back to Tutorials Chapter 20

References

This final chapter serves as a comprehensive reference for Angular's core API, DOM abstractions, and key modules. Use it as a quick lookup guide when building your applications.

Angular Core API

The @angular/core package provides the foundational building blocks of any Angular application.

Decorators

Core Classes

DOM Reference (Renderer2)

Use Renderer2 instead of directly manipulating the DOM. It ensures compatibility across different rendering environments (browser, server, web worker).

@Directive({ selector: '[appHighlight]' })
export class HighlightDirective {
  constructor(private renderer: Renderer2, private el: ElementRef) {}

  @HostListener('mouseenter')
  onMouseEnter() {
    this.renderer.setStyle(this.el.nativeElement, 'background', 'yellow');
  }

  @HostListener('mouseleave')
  onMouseLeave() {
    this.renderer.removeStyle(this.el.nativeElement, 'background');
  }

  setColor(color: string) {
    this.renderer.setStyle(this.el.nativeElement, 'color', color);
  }
}

API Reference by Module

Router (@angular/router)

Forms (@angular/forms)

HTTP (@angular/common/http)

Compiler (@angular/compiler)

Animations (@angular/animations)

Common (@angular/common)

Platform Browser (@angular/platform-browser)

Platform Browser Dynamic (@angular/platform-browser-dynamic)

Angular API reference
Bookmark the official Angular API documentation at angular.io/api for the most up-to-date and comprehensive reference.
Practice Task: Create a reference card (cheat sheet) for yourself that lists the top 20 Angular APIs you use most frequently. Include the import path, a brief description, and a one-line code example for each.