Angular:

http://angularjs.org/

by mrajcok

HTML

<div ng-controller="MyCtrl">
     <button ng-click="save()" ng-disabled="isClean()">Save</button>
</div>

JavaScript

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

app.directive('myDirective', function () {
    return {
        link: function (scope, element, attrs) {},
    }
});
//app.factory('myService', function() {});

function MyCtrl($scope) {
    $scope.init = function () {
        if (true) { // $routeParams.Id) {
            //get an existing object
        } else {
            //create a new object
        }
        $scope.isSaving = false;
    }
    $scope.isClean = function () {
       console.log('isSaving=',$scope.isSaving);
       return $scope.hasChanges() && !$scope.isSaving;
    }
    $scope.hasChanges = function() { return false }
    $scope.init();
}