Created
August 18, 2014 20:25
-
-
Save steinbring/eb3db85786e024224101 to your computer and use it in GitHub Desktop.
How to instantiate the ngStorage module with defaults
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The module | |
var NotesApp = angular.module('NotesApp', ['ngStorage']); | |
// The controller | |
NotesApp.controller('NotesCtrl', function($scope, $localStorage) { | |
// Set a default | |
$scope.$storage = $localStorage.$default({ | |
"notes": [{ | |
"title": "What is the notes vault?", | |
"content": "It is an AngularJS experiment, done by Joe Steinbring. I think it is fairly cool." | |
}, { | |
"title": "Things Joe blogs about", | |
"content": "- Movies\n- Photography\n- Coding" | |
}] | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment