Created
July 6, 2015 09:48
-
-
Save SuThaw/cb2f2d559b6f3e8a09f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<title>Todo</title> | |
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" type="text/css" media="screen" charset="utf-8"> | |
<style type="text/css" media="screen"> | |
.done-true{ | |
text-decoration:line-through; | |
} | |
</style> | |
</head> | |
<body ng-app="app"> | |
<div class="container" ng-controller = "TodoCtrl"> | |
<h1>To Do List</h1> | |
<form role="form"> | |
<div class="form-group"> | |
<div class="input-group"> | |
<input class="form-control" type="text" ng-model="todoBody"> | |
<span class="input-group-btn"> | |
<button class="btn btn-default" ng-click="addTodo()">Add To Do</button> | |
</span> | |
</div> | |
</div> | |
<ul class="list-group"> | |
<li class="list-group-item" ng-repeat="todo in todos"> | |
<div class="checkbox" > | |
<label> | |
<input ng-model="todo_done" type="checkbox" > <span class="done-{{todo_done}}">{{todo.todo}}</span> | |
</label> | |
</div> | |
</li> | |
</ul> | |
</form> | |
</div> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> | |
<script type="text/javascript" charset="utf-8"> | |
var app = angular.module('app',[]); | |
app.controller('TodoCtrl',function($scope){ | |
$scope.todos = [{user:'suthaw',todo:'Go to school'},{user:'suthaw',todo:'go to library'}]; | |
$scope.addTodo = function(){ | |
$scope.todos.unshift({ | |
user:'suthaw', | |
todo:$scope.todoBody | |
}); | |
$scope.todoBody = null; | |
} | |
}); | |
</script> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment