diff --git a/views/index.ejs b/views/index.ejs
index 9c3ef46..afb37e1 100644
--- a/views/index.ejs
+++ b/views/index.ejs
@@ -22,6 +22,7 @@
{{todo.name}}
+
@@ -37,6 +38,7 @@
note:
+
Cancel
@@ -85,6 +87,13 @@
$scope.todos[index] = angular.copy($scope.editing[index]);
$scope.editing[index] = false;
}
+
+ $scope.remove = function(index){
+ var todo = $scope.todos[index];
+ Todos.remove({id: todo._id}, function(){
+ $scope.todos.splice(index, 1);
+ });
+ }
}])
.controller('TodoDetailCtrl', ['$scope', '$routeParams', 'Todos', '$location', function ($scope, $routeParams, Todos, $location) {
@@ -95,6 +104,12 @@
$location.url('/');
});
}
+
+ $scope.remove = function(){
+ Todos.remove({id: $scope.todo._id}, function(){
+ $location.url('/');
+ });
+ }
}])
//---------------