From 7fc5c28ad48f11fd5d8dac53c6310f44586b5fba Mon Sep 17 00:00:00 2001 From: KevinKrames Date: Mon, 14 Sep 2015 16:21:33 -0400 Subject: [PATCH 1/2] Add complete button, reconstructed how we store the data so that each todo item has several variables. Cleaned up how the buttons look on the right side of the todo item. --- todo-src/index.html | 19 ++++++++++++++----- todo-src/script.js | 19 +++++++++++++++---- todo-src/style.css | 2 +- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/todo-src/index.html b/todo-src/index.html index 89203ad..1ce0c8d 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -28,12 +28,21 @@

stuff i gotta do asap

diff --git a/todo-src/script.js b/todo-src/script.js index fe21743..cd12946 100644 --- a/todo-src/script.js +++ b/todo-src/script.js @@ -3,22 +3,33 @@ var myApp = angular.module('app', []); myApp.controller('MainCtrl', function ($scope){ - $scope.todos = ["Learn Angular", "Learn node"]; + $scope.todos = [{name: "Learn Angular", done:false}, {name: "Learn node", done:false}]; $scope.newItem = ""; $scope.addItem = function(){ console.log("in add"); if ($scope.newItem !== ""){ - $scope.todos.push($scope.newItem); + var addItem = {name:$scope.newItem, done:false}; + $scope.todos.push(addItem); $scope.newItem = ""; + } } - $scope.deleteItem = function(item){ + $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("completed item"); + $scope.todos[index].done = true; + } + + $scope.uncompleteItem = function(index) { + console.log("uncompleted item"); + $scope.todos[index].done = false; + } }); diff --git a/todo-src/style.css b/todo-src/style.css index eb51b03..0458267 100644 --- a/todo-src/style.css +++ b/todo-src/style.css @@ -1,4 +1,4 @@ /* Styles go here */ body { background: green; -} +} \ No newline at end of file From 4e189bace870f52126f3d6691532c036fb66cb47 Mon Sep 17 00:00:00 2001 From: csturco0331 Date: Tue, 15 Sep 2015 10:53:51 -0400 Subject: [PATCH 2/2] Added the ability to delete all tasks marked as completed --- todo-src/index.html | 7 ++++++- todo-src/script.js | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/todo-src/index.html b/todo-src/index.html index 1ce0c8d..3249f8b 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -25,7 +25,12 @@

My little to do app!

stuff i gotta do asap

- + +
+ +