ITS381: TodoListApp html, js, and css files for exercise

How to test the following using CodePen.io?

The following files are copied from the angularjs.org website

index.html file<pre>

<!doctype html>
<html ng-app=”todoApp”>
<head>
https://ajax.googleapis.com/ajax/libs/angularjs/1.7.2/angular.min.js
http://todo.js
<link rel=”stylesheet” href=”todo.css”>
</head>
<body>
<h2>Todo</h2>

{{todoList.remaining()}} of {{todoList.todos.length}} remaining
[ archive ]
{{todo.text}}

</body>
</html>

</pre>

todo.js file<pre>

angular.module(‘todoApp’, [])
.controller(‘TodoListController’, function() {
var todoList = this;
todoList.todos = [
{text:’learn AngularJS’, done:true},
{text:’build an AngularJS app’, done:false}];

todoList.addTodo = function() {
todoList.todos.push({text:todoList.todoText, done:false});
todoList.todoText = ”;
};

todoList.remaining = function() {
var count = 0;
angular.forEach(todoList.todos, function(todo) {
count += todo.done ? 0 : 1;
});
return count;
};

todoList.archive = function() {
var oldTodos = todoList.todos;
todoList.todos = [];
angular.forEach(oldTodos, function(todo) {
if (!todo.done) todoList.todos.push(todo);
});
};
});

</pre>

todo.css file <pre>

.done-true {
text-decoration: line-through;
color: grey;
}

</pre>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s