The angular-localforage library makes simple offline storage easy.
The easiest way to set up offline support in Angular is to use the localForage library, which gives you a directive called local-forage. I'm going to parse in a user saying that I want the store for offline use.
Meaning when I refresh my page and I type "John Lindquist," I go in and I check my key value parse table here, you can see I have a key with user that has an object of John Lindquist to a first name and last name.
If I refresh the page, I already have John and Lindquist populated without me typing anything because I grabbed it from my index DB, and populated it for me.
To get the localForage library, go ahead and do bower install angular-localforage, or Google localForage with Angular. You'll get three things.
One is the Angular library. The second is the localForage library, and the third is the wrapper library to make it angularized, so you don't have to do scope apply and things like that.
Once you have those three things loaded in, all you need to do is make sure and include the localForage module in one of your modules.
Other than that, to use a directive, you don't need any controllers. You don't need to configure anything. You can go ahead and set it up using the local-forage directive.
As soon as you type something, such as fill harmonic, and then I refresh the page, you can see that it saved that. If my site were offline, it would go ahead and display that again for me.
This is a very basic use case. We'll go ahead and cover more in doing this through the code and getting in setting values like that in future videos.