Skip to content

Instantly share code, notes, and snippets.

@kauffmanes
Last active June 18, 2017 14:35
Show Gist options
  • Save kauffmanes/cd9d6ddf5c8a82cb9b74f18579421b0b to your computer and use it in GitHub Desktop.
Save kauffmanes/cd9d6ddf5c8a82cb9b74f18579421b0b to your computer and use it in GitHub Desktop.
v3 app
//Parses and saves to localStorage
$scope.save = function () {
var stringCopy = '';
//lc only accepts strings
//allows us to reference this lc record later
$scope.formData.lcKey = Date.now().toString();
try {
stringCopy = JSON.stringify($scope.formData);
} catch (err) {
//error handling for bad form submission
console.debug(err);
return;
}
localStorage[$scope.formData.lcKey] = stringCopy;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment