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:
- Load/instantiate a view model
- Load/instantiate a view
- Bind the view to the view model
- Append the view to the DOM
- Handle click on a link by user.
- Parse the URL hash, determine which view model to load/instantiate, check whether the current view can be deactivated, and more
- 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 at the application level because the framework does that job for you. Instead, you focus on writing the views, view...