diff --git a/todo-src/index.html b/todo-src/index.html index 89203ad..7fcc5de 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -11,34 +11,54 @@

My little to do app!

- +
- +
-
- +

stuff i gotta do asap

- + +
+
+ + +

+ Completed Items +

+ + + +
- + diff --git a/todo-src/script.js b/todo-src/script.js index fe21743..db64fce 100644 --- a/todo-src/script.js +++ b/todo-src/script.js @@ -3,24 +3,53 @@ var myApp = angular.module('app', []); myApp.controller('MainCtrl', function ($scope){ - $scope.todos = ["Learn Angular", "Learn node"]; + + $scope.todos = [ + { + text: "Learn Angular" + }, + { + text: "Learn node" + } + ]; + + $scope.completeItems = []; + $scope.newItem = ""; - + $scope.addItem = function(){ console.log("in add"); if ($scope.newItem !== ""){ - $scope.todos.push($scope.newItem); + $scope.todos.push({ + text: $scope.newItem, + }); $scope.newItem = ""; } } - - $scope.deleteItem = function(item){ + $scope.toggleEditMode = function() + { + console.log("in edit"); + $scope.editmode = !($scope.editmode); + } + + $scope.deleteItem = function(index){ console.log("in delete"); - var index = $scope.todos.indexOf(item); $scope.todos.splice(index, 1); } - - + + $scope.completeItem = function(index) { + console.log("in complete"); + $scope.completeItems.push({ + text: $scope.todos[index].text, + }); + $scope.deleteItem(index); + } + + $scope.clearCompletedItems = function() { + console.log("in clearCompletedItems"); + $scope.completeItems.length = 0; + } + }); /************************* @@ -32,5 +61,5 @@ myApp.controller('MainCtrl', function ($scope){ * - make it prettier * - add a due date * - add reminder (setInterval) - * - * *********************/ \ No newline at end of file + * + * *********************/ diff --git a/todo-src/style.css b/todo-src/style.css index eb51b03..a0bd892 100644 --- a/todo-src/style.css +++ b/todo-src/style.css @@ -2,3 +2,9 @@ body { background: green; } + + +/* Styling for complete */ +#complete { + text-decoration: line-through; +} \ No newline at end of file