diff --git a/todo-src/index.html b/todo-src/index.html index 89203ad..6e22a0c 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -11,9 +11,9 @@

My little to do app!

- +
- +
@@ -23,22 +23,32 @@

My little to do app!

- +

stuff i gotta do asap

- + +
- + diff --git a/todo-src/script.js b/todo-src/script.js index fe21743..82a4f8e 100644 --- a/todo-src/script.js +++ b/todo-src/script.js @@ -3,26 +3,43 @@ var myApp = angular.module('app', []); myApp.controller('MainCtrl', function ($scope){ - $scope.todos = ["Learn Angular", "Learn node"]; + $scope.todos = [{name: "Learn Angular", isChecked: false }, {name: "Learn node", isChecked: false }]; $scope.newItem = ""; - + $scope.addItem = function(){ console.log("in add"); if ($scope.newItem !== ""){ - $scope.todos.push($scope.newItem); + $scope.todos.push({name: $scope.newItem, isChecked: false }); $scope.newItem = ""; } } - + $scope.deleteItem = function(item){ console.log("in delete"); var index = $scope.todos.indexOf(item); $scope.todos.splice(index, 1); } - - -}); + $scope.deleteCheckedItems = function(){ + for(var i = 0; i < $scope.todos.length; i++){ + if($scope.todos[i].isChecked){ + $scope.todos.splice(i,1); + i--; + } + } + + } + + $scope.later = function(item){ + console.log("Task Set to be done later"); + alert("Task set to be done Later"); + } + $scope.tom = function(item){ + console.log("Task set to be done Tomorrow"); + alert("Task set to be done Tomorrow"); + } + +}); /************************* * Homework (not rly): * - "enter" button functionality instead of clicking button @@ -32,5 +49,5 @@ myApp.controller('MainCtrl', function ($scope){ * - make it prettier * - add a due date * - add reminder (setInterval) - * - * *********************/ \ No newline at end of file + * + * *********************/