From f1cc52529414ae2729717dbec191838446608885 Mon Sep 17 00:00:00 2001 From: Kiran Date: Sat, 30 Mar 2013 13:26:17 +0530 Subject: [PATCH] Kiran | Completed Basic and Todo tutorial. --- src/todo/todo.css | 4 ++++ src/todo/todo.html | 26 ++++++++++++++++++++++++++ src/todo/todo.js | 26 ++++++++++++++++++++++++++ src/tutorial-1/index.html | 14 ++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 src/todo/todo.css create mode 100644 src/todo/todo.html create mode 100644 src/todo/todo.js create mode 100644 src/tutorial-1/index.html diff --git a/src/todo/todo.css b/src/todo/todo.css new file mode 100644 index 0000000..8c4e490 --- /dev/null +++ b/src/todo/todo.css @@ -0,0 +1,4 @@ +.done-true { + text-decoration: line-through; + color: grey; +} \ No newline at end of file diff --git a/src/todo/todo.html b/src/todo/todo.html new file mode 100644 index 0000000..7a91a55 --- /dev/null +++ b/src/todo/todo.html @@ -0,0 +1,26 @@ + + + + + + + TODO + + +

Todo

+
+ {{remaining()}} of {{todos.length}} remaining + [archive] + +
+ + \ No newline at end of file diff --git a/src/todo/todo.js b/src/todo/todo.js new file mode 100644 index 0000000..64f5409 --- /dev/null +++ b/src/todo/todo.js @@ -0,0 +1,26 @@ +function TodoController($scope) { + $scope.todos = [ + {"text": "Task 1", "done": false}, + {"text": "Task 2", "done": false}, + {"text": "Task 3", "done": true} + ]; + + $scope.addTodo = function() { + $scope.todos.push({"text" : $scope.todoText, "done": false}); + $scope.todoText = ""; + }; + + $scope.remaining = function() { + var notDone = $scope.todos.filter(function(todo) { + return !todo.done; + }); + return notDone.length; + }; + + $scope.archive = function() { + var notDoneOnes = $scope.todos.filter(function(todo) { + return !todo.done; + }); + $scope.todos = notDoneOnes; + }; +} \ No newline at end of file diff --git a/src/tutorial-1/index.html b/src/tutorial-1/index.html new file mode 100644 index 0000000..ff6cd74 --- /dev/null +++ b/src/tutorial-1/index.html @@ -0,0 +1,14 @@ + + + + + Basic Tutorial + + +
+ + +

Hello {{name}}

+
+ + \ No newline at end of file