AngularJS Example:
by Andrey Zenkov
HTML
<div ng-app="todoApp">
<div ng-controller="TodoController">
<h2>{{ counter ? counter + " раз":0+" раз"}}</h2>
<input type="text" ng-keyup="keyPress($event.keyCode)"
ng-model="todotext" size="30"
placeholder="add new todo here">
</div>
</div>
CSS
</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ -->
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.0.4/css/bootstrap-combined.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js"></script>
<style>
.done-true {
text-decoration: line-through;
color: grey;
}
JavaScript
angular.module('todoApp', [])
.controller('TodoController', ['$scope', function($scope) {
$scope.counter = 0;
$scope.keyPress = function(code) {
if (code === 13) $scope.counter++;
}
}]);