Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Angular's Future with Signals @ngStuttgart

Angular's Future with Signals @ngStuttgart

Manfred Steyer

July 04, 2023
Tweet

More Decks by Manfred Steyer

Other Decks in Programming

Transcript

  1. @ManfredSteyer Zone.js: Monkey Patching After Event Handler: Inform Angular CD

    Checks Components all components (default) or selected ones (OnPush)
  2. @ManfredSteyer Zone.js: Magic Zone.js: ~100K Cannot patch async/await coarse grained

    CD e.g. Components are always checked as a whole, even if only a tiny fraction changed
  3. @ManfredSteyer flights: Flight[] = []; const flights = await this.flightService.findAsPromise(from,

    to); this.flights = flights; <div *ngFor="let f of flights"> <flight-card [item]="f" /> </div>
  4. @ManfredSteyer flights = signal<Flight[]>([]); const flights = await this.flightService.findAsPromise(from, to);

    this.flights.set(flights); <div *ngFor="let f of flights()"> <flight-card [item]="f" /> </div>
  5. @ManfredSteyer @Component({ signals: true, selector: 'temperature-calc', template: ` <p>C: {{

    celsius() }}</p> <p>F: {{ fahrenheit() }}</p> `, }) export class SimpleCounter { celsius = signal(25); fahrenheit = computed(() => this.celsius() * 1.8 + 32); } Taken from the Signals RFC: https://github.com/angular/angular/discussions/49685
  6. @ManfredSteyer @Component({ signals: true, selector: 'temperature-calc', template: ` <p>C: {{

    celsius() }}</p> <p>F: {{ fahrenheit() }}</p> `, }) export class SimpleCounter { celsius = input(25); fahrenheit = computed(() => this.celsius() * 1.8 + 32); }
  7. @ManfredSteyer Fine-grained CD Zone-less Future Convertible to Observables and vice

    versa! No need to unsubscribe! No need to update code!
  8. @ManfredSteyer • Maintainable Architectures • 🆕🔥 Standalone Components & APIs

    • Micro Frontends and Module Federation • 🆕🔥 Signals and Your Architecture: CD, NGRX, RxJS-Interop Public or Company Training, Remote or On-Site German: angulararchitects.io/workshop-de English: angulararchitects.io/workshop-en