Nov 3, 2018

Angular 2: components, dependency injection, and bindings

Components are fundamental building blocks of Angular 2 applications.

  • They have well-defined inputs and outputs.
  • They have well-defined lifecycle.
  • They are self-describing.

Dependency injection is important for large projects

  • It allows you to depend on interfaces, not concrete types.
  • This results in more decoupled code.
  • This improves testability.
  • Angular 2 has one API for injecting dependencies into components.
  • Angular uses property bindings to sync up the component tree with the model, and the DOM with the component tree.
  • Angular uses zones to know when to do it.