0

I have this form

<form ng-submit="addState()">
            <input ng-model="text1" type="text">
            <input ng-model="text2" type="text">
            <input ng-model="text3" type="text">     
</form>

and this JS

mainAppControllers.controller('DoarScanCtrl', ['$scope', '$routeParams', '$location',
    function($scope, $routeParams, $location){

    }
]);

So First i need save the data in local storage and after this i need have a json

Thank you for any help!

1
  • What is the data you want to save to localStorage? Commented Jan 23, 2015 at 19:58

2 Answers 2

1

I would recommend this lib https://github.com/grevory/angular-local-storage it also auto convert object and array to json

localStorageService.set("model", $scope.model);

$scope.model2= localStorageService.get("model");

i made a fiddle how to use http://jsfiddle.net/jgs4280c/

Sign up to request clarification or add additional context in comments.

Comments

0

I have tried several of the available local storage packages and settled for https://github.com/agrublev/angularLocalStorage

It is quite simplistic, but it works very reliably compared to others.

And you can both bind your ng-model directly to the local storage key and then it's done, or you can use legacy style getter/setter where that suits better.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.