Created
November 2, 2013 07:12
-
-
Save Miuler/7276419 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Original source at: http://angularjs.org/#todo-js | |
window.TodoCtrl = ($scope) -> | |
$scope.todos = [ | |
{text: 'learn angular', done: true}, | |
{text: 'build an angular app', done: false} | |
] | |
$scope.addTodo = -> | |
$scope.todos.push({text: $scope.todoText, done: false}) | |
$scope.todoText = '' | |
$scope.remaining = -> | |
count = 0 | |
for todo in $scope.todos | |
count += todo.done ? 0: 1 | |
count | |
$scope.archive = -> | |
oldTodos = $scope.todos | |
$scope.todos = [] | |
for todo in oldTodos | |
$scope.todos.push(todo) unless todo.done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment