Caching form submissions offline

Hi, I am building an app using Ionic that has a contact/application form included in it.

What is the best way to cache any submission made while there is no internet connection and submit them once a connection is made?

Any help on tis would be awesome.