Commit aa8db405 authored by Jacob Mumm's avatar Jacob Mumm

added persistence clearCompletedItems

parent 1e6515ff
...@@ -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