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); + } });