Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions todo-src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,21 @@ <h2>stuff i gotta do asap</h2>
<button class="btn btn-danger pull-right" type="button" ng-click="deleteItem(do)">
<span class="glyphicon glyphicon-trash " aria-hidden="true"></span>
</button>

<button class="btn btn-success pull-right" type="button" ng-click="completeItem(do)">
<span class="glyphicon glyphicon-ok " aria-hidden="true"></span>
</button>

</li>
</ul>

<h2>completed stuff</h2>

<ul class="list-group">
<!-- http://www.w3schools.com/css/css_float.asp -->
<li class="list-group-item clearfix" ng-repeat="do in completed">
<span>{{do}}</span>
</li>
</ul>
</div>

Expand Down
8 changes: 8 additions & 0 deletions todo-src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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);
}


});
Expand Down