From 2c2f3bf2fefbd671be0c0af40f9c2064e22ed62c Mon Sep 17 00:00:00 2001 From: Brandi Date: Wed, 20 Sep 2017 16:38:47 -0400 Subject: [PATCH] complete button and complete list added --- todo-src/index.html | 13 +++++++++++++ todo-src/script.js | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/todo-src/index.html b/todo-src/index.html index 89203ad..078973e 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -34,8 +34,21 @@

stuff i gotta do asap

+ + + + +

completed stuff

+ + diff --git a/todo-src/script.js b/todo-src/script.js index fe21743..911b56b 100644 --- a/todo-src/script.js +++ b/todo-src/script.js @@ -5,6 +5,7 @@ var myApp = angular.module('app', []); myApp.controller('MainCtrl', function ($scope){ $scope.todos = ["Learn Angular", "Learn node"]; $scope.newItem = ""; + $scope.completed = []; $scope.addItem = function(){ console.log("in add"); @@ -19,6 +20,13 @@ myApp.controller('MainCtrl', function ($scope){ var index = $scope.todos.indexOf(item); $scope.todos.splice(index, 1); } + + $scope.completeItem = function(item){ + console.log("in complete"); + var index = $scope.todos.indexOf(item); + $scope.completed.push($scope.todos[index]); + $scope.todos.splice(index, 1); + } });