The Tale Tell Code | Lara Newsom | ng-conf 2022

Learn how to write better Angular code, avoid functions in templates, and optimize performance by mastering Angular pipes, iterative change detection, and reactive programming techniques.

Key takeaways
  • The author warns against using functions in templates and advises using Angular pipes instead.
  • Optional chaining can lead to bloated code, make it hard to refactor, and create unreachable and untestable code.
  • Angular is not pure by default, and functions in templates are not considered pure functions.
  • Angular change detection runs a lot, which can lead to slow app performance.
  • Change detection can be optimized by eliminating unneeded component properties and subscriptions.
  • Reactive programming can be used to manage state and component properties.
  • It’s recommended to use a pipe instead of a setter or void function to manage data.
  • Avoid using optional chaining everywhere, as it can indicate a lack of understanding about its limitations.
  • The author recommends simplifying code by eliminating unnecessary code and reducing the number of component properties.
  • The author encourages developers to write better code and highlights the importance of understanding Angular’s change detection strategy.
  • Key concepts include:
    • Angular pipes
    • Optional chaining
    • Angular change detection
    • pure functions
    • Reactive programming