Angular: Empty Fiddle

http://angularjs.org/

HTML

<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<div ng-controller="MyCtrl">
  <button id="submit" ng-click="test()">
  Submit
  </button>
  <disable-button></disable-button>
</div>

JavaScript

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

myApp.directive('disableButton', function () {
            return {
                restrict: 'E',
                compile: function (el, attr) {
                    return {
                        pre: function (scope, el, attr) {

                        },
                        post: function (scope, el, attr) {
                        alert("test");
                            $('#submit').attr("disabled", true);
                        }
                    }
                }
            }
        })

function MyCtrl($scope) {
    $scope.test = function () {
  alert("button is disabled");
  };
  }