Learning how DI works

DI is based on the Inversion of control pattern. Let’s explain that.

Imagine that we create a web application without Aurelia. You will have to manually implement something like this:

  1. Load/instantiate a view model
  2. Load/instantiate a view
  3. Bind the view to the view model
  4. Append the view to the DOM
  5. Handle click on a link by user.
  6. Parse the URL hash, determine which view model to load/instantiate, check whether the current view can be deactivated, and more
  7. Rinse and repeat

Again, and many more times.  Without Aurelia, you are implementing the logic that controls the application life cycle instead of your application business logic and features.

Now, let's create one using Aurelia. You won't work on any configuration code ...

Get Hands-On Full Stack Web Development with Aurelia now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.