src/angular-autodisable.js
/**
     * The link function for this directive.
     * Contains a prepended function that represents the ngClick handler.
     *
     * @param {Array} handlers array of click handler
     * @param {Object} scope scope
     * @param {Angular Element} element directive element
     * @param {Object} attrs attributes
     */
The link function for this directive.
Contains a prepended function that represents the ngClick handler.

@param {Array} handlers array of click handler
@param {Object} scope scope
@param {Angular Element} element directive element
@param {Object} attrs attributes
The link function for this directive . Contains a prepended function that represents the ngClick handler . @param { Array } handlers array of click handler @param { Object } scope scope @param { Angular Element } element directive element @param { Object } attrs attributes
function linkFn(scope, element, attrs) {
      var handler;
      if (attrs.hasOwnProperty(CLICK_ATTR)) {
          handler = handlerInstance(element,
              CLICK_EVENT,
              getLoadingClass(attrs),
              getCallbacks(attrs[CLICK_ATTR]));
      } else if (attrs.hasOwnProperty(SUBMIT_ATTR)) {
          handler = handlerInstance($("button[type=submit]", element),
              SUBMIT_EVENT,
              getLoadingClass(attrs),
              getCallbacks(attrs[SUBMIT_ATTR]));
      } else {
          throw new Error('ngAutodisable requires ngClick or ngSubmit attribute in order to work');
      }
      element.unbind(handler.eventName).bind(handler.eventName, function(event) {
        scope.$apply(function() {
          handler.callbacks.forEach(triggerHandler.bind(null, handler, scope, event));
        });
      });
    }
function linkFn ( scope , element , attrs ) { var handler ; if ( attrs . hasOwnProperty ( CLICK_ATTR ) ) { handler = handlerInstance ( element , CLICK_EVENT , getLoadingClass ( attrs ) , getCallbacks ( attrs [ CLICK_ATTR ] ) ) ; } else if ( attrs . hasOwnProperty ( SUBMIT_ATTR ) ) { handler = handlerInstance ( $ ( "button[type=submit]" , element ) , SUBMIT_EVENT , getLoadingClass ( attrs ) , getCallbacks ( attrs [ SUBMIT_ATTR ] ) ) ; } else { throw new Error ( 'ngAutodisable requires ngClick or ngSubmit attribute in order to work' ) ; } element . unbind ( handler . eventName ) . bind ( handler . eventName , function ( event ) { scope . $apply ( function ( ) { handler . callbacks . forEach ( triggerHandler . bind ( null , handler , scope , event ) ) ; } ) ; } ) ; }
The link function for this directive.
The link function for this directive .
// Remove the click handler and replace it with our new one // with this move we completely disable the original ngClick functionality // Make sure we run the $digest cycle