Links data in html form with local or session storage through two directives.
Can also bind several forms with one storage.
vsHandyStorage uses ngStorage module as a dependency.
bower install vs-handy-storage
Usage | Demo
-
Add vsHandyStorage.js to your index.html
-
Add module dependency:
angular.module('yourApp', ['vsHandyStorage']);
- Create storage and set its name through the vs-local-storage (or vs-session-storage) directive:
<form vs-local-storage="storageName">
</form>
- Bind any form element with created storage through the vs-link-storage directive:
<form vs-local-storage="storageName">
<input ng-model="name" type="text" name="name" vs-link-storage>
</form>
Important, that the attribute name on the form element matches the field name in the storage. Important, that vs-link-storage directive requires declaration of ng-model directive.