AngularJS Example:

by John Grivas

HTML

<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<div ng-app>
     <h2>Todo</h2>

    <div ng-controller="TodoCtrl">
        <form ng-submit="howmany()">
            <input class="btn-primary" type="submit" value="add">
        </form>
    </div>
</div>

CSS

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

JavaScript

function TodoCtrl($scope) {
    $scope.todos = [{
        text: 'learn angular',
        done: true
    }, {
        text: 'build an angular app',
        done: false
    }];

    $scope.addTodo = function () {
        $scope.todos.push({
            text: $scope.todoText,
            done: false
        });
        $scope.todoText = '';
    };


    $scope.roster = [{
        id: 1,
        attended: true,
        person: {
            printName: 'Larry'
        }
    }, {
        id: 2,
        attended: false,
        person: {
            printName: 'Curly'
        }
    }, {
        id: 3,
        attended: true,
        person: {
            printName: 'Moe'
        }
    }];

    $scope.howmany = function () {
        var count = 0;
        angular.forEach($scope.roster, function (roster) {
            count += roster.attended ? 1 : 0;
        });
        alert(count);
        return count;
    };


}