Permalink
Browse files

added list item delete

  • Loading branch information...
=
= committed Feb 23, 2018
1 parent 3a95d87 commit 91300a685a8b15328680c1f09e99417e40e35071
Showing with 12 additions and 49 deletions.
  1. +0 −44 ToDo.html
  2. +12 −5 index.html

This file was deleted.

Oops, something went wrong.
@@ -6,7 +6,7 @@
<script src="angular.js"></script>
<link rel="stylesheet" type="text/css" href="todo.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">

<script>
// Todo module
var Todo = angular.module("Todo", []);
@@ -25,20 +25,27 @@
$scope.items.push($scope.new);
$scope.new = '';
};
};
// Delete list item at index
$scope.del = function(index){
$scope.items.splice(index, 1);
}
});
</script>
</head>

<body ng-controller="ToDoCtrl">
<div clas="container">
<h1>To Do</h1>
<ul ng-repeat="item in items track by $index">
<li>{{ item }}</li>
<li>{{ item }} <button type="submit" ng-click="del($index)">X</button></li>

</ul>
<input type="text" ng-model="new"/>
<button type="submit" ng-click="add()">Add</button>

</div>


</body>

0 comments on commit 91300a6

Please sign in to comment.