Angular: Empty Fiddle

http://angularjs.org/

by acbabis

HTML

<div ng-controller="MyCtrl">
    Clicked {{clickCount}} times
    <button ng-click="incrementCount()">Doober</button>
    <input type="text" ng-model="clickCount" />
</div>

JavaScript

var myApp = angular.module('myApp',[]);

myApp.controller('MyCtrl', function MyCtrl($scope) {
    var clickCount = 0; // Private variable
    
    Object.defineProperty($scope, 'clickCount', {
        set: function() { // Prevent views from editing data
            throw new Error('Operation not supported');
        },
  		get: function() {
            return clickCount;
        }
	});
    
    $scope.incrementCount = function() {
        clickCount++;
    }
});