Chapter 6: Building a Shopping Cart Using Application State
Sometimes, we need our applications to maintain state between different pages. We can accomplish this by using dependency injection (DI). DI is used to access services that are configured in a central location.
In this chapter, we will create a shopping cart. As you add and delete items from the shopping cart, the application will maintain a list of the items in the shopping cart. The contents of the shopping cart will be retained when a user navigates to another page and then returns to the page with the shopping cart. Also, the shopping cart's total will be displayed on all of the pages.
In this chapter, we will cover the following topics:
- Application state
- Dependency injection
- Creating the shopping cart project