Commit acaab077 authored by Addy Osmani's avatar Addy Osmani

Merge pull request #20 from jacobmumm/master

quick fix to angular-persistence demo
parents fed955b1 aa8db405
...@@ -59,6 +59,7 @@ App.Controllers.TodoController = function (persistencejs) { ...@@ -59,6 +59,7 @@ App.Controllers.TodoController = function (persistencejs) {
angular.forEach(oldTodos, function(todo) { angular.forEach(oldTodos, function(todo) {
if (!todo.done) self.todos.push(todo); if (!todo.done) self.todos.push(todo);
}); });
persistencejs.clearCompletedItems();
}; };
self.hasFinishedTodos = function() { self.hasFinishedTodos = function() {
......
...@@ -28,6 +28,10 @@ angular.service('persistencejs', function() { ...@@ -28,6 +28,10 @@ angular.service('persistencejs', function() {
}); });
}, },
clearCompletedItems: function(){
Todo.all().filter('done','=',true).destroyAll();
},
remove: function(item){ remove: function(item){
Todo.all().filter('content','=',item.content).destroyAll(); Todo.all().filter('content','=',item.content).destroyAll();
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment