From the course: Angular: Testing and Debugging

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Adding a local storage service

Adding a local storage service - Angular Tutorial

From the course: Angular: Testing and Debugging

Start my 1-month free trial

Adding a local storage service

- [Instructor] Let's add a feature in our app that lets users save the current filter state. There are many ways we could do this but to keep things simple, I'm going to use local storage. Local storage is one of several client side data storage options available on all modern browsers and it's an excellent choice for our use case here. In local storage, data is stored as simple key value pairs and the data persists between browsing sessions until it's deleted by the user or some trigger in our app code. This means we can restore the filter on page load even after the user closes the browser window. Check out the course managing data in Angular two applications here in our library for an in-depth look at all your data storage options for Angular. I'm in VSA code here and I already installed the NPM packages and launched a local dev server. I'm going to make a new file now using the Angular CLI tool. I'll need a new terminal window, so I'll go to this plus sign here click on it to open…

Contents