(function(ng) {
  'use strict';
  var Switcher = function(elem, status, disabled) {
    this.elem = elem;
    this.onAnimate = false;
    this.initialize();
    this.setStatus(status, true);
    this.disabled(disabled);
  };

  Switcher.prototype.setStatus = function(status, setOffset) {
    if (status === true) {
      this.elem.addClass('on');
      this.elem.removeClass('off');
    } else {
      this.elem.addClass('off');
      this.elem.removeClass('on');
      if (setOffset) {
        this.innerElem.css('left', - this.onElem.outerWidth());
      }
    }
  };

  Switcher.prototype.disabled = function(disabled) {
    if (disabled) {
      this.elem.addClass('disabled');
    } else {
      this.elem.removeClass('disabled');
    }
  };

  Switcher.prototype.initialize = function() {
    var elem = this.elem;
    var innerElem = this.innerElem = elem.find('.adminui-switcher-inner');
    var onElem = this.onElem = elem.find('.on-label');
    var offElem = this.offElem = elem.find('.off-label');
    var onElemWidth = onElem.outerWidth();
    var offElemWidth = offElem.outerWidth();
    var dividerElemWidth = elem.find('.divider').outerWidth();
    var elemWidth = Math.max(onElemWidth, offElemWidth);
    elem.width(elemWidth + dividerElemWidth + 2);
    onElem.css('width', elemWidth);
    offElem.css('width', elemWidth);
    innerElem.width(
      elemWidth * 2 + dividerElemWidth
    );
  };

  Switcher.prototype.switch = function(value, callback) {
    var newValue = !value;
    var elem = this.elem;
    var offset;
    if (newValue == true) {
      offset = 0;
    } else {
      offset = - this.onElem.outerWidth();
    }
    this.onAnimate = true;
    this.setStatus(newValue);
    this.innerElem.animate({
      left: offset
    }, 200, function() {
      this.onAnimate = false;
      if (callback) {
        callback.call(this, newValue);
      }
    }.bind(this));
  };

  var SwitcherDirective = function($timeout) {
    return {
      restrict: 'A',
      replace: true,
      scope: {
        model: '=ngModel',
        disabled: '=disabled',
        ngChange: '&',
        ngClick: '&',
        onLabel: '@',
        offLabel: '@'
      },
      templateUrl: 'templates/adminui-switcher.html',
      link: function(scope, elem, attrs) {
        $timeout(function() {
          scope.onLabel = scope.onLabel ?
            scope.onLabel : '<i class="glyphicon glyphicon-ok"></i>';
          scope.offLabel = scope.offLabel ?
            scope.offLabel : '<i class="glyphicon glyphicon-remove"></i>';
          $timeout(function() {
            var switcher = new Switcher(elem, scope.model, scope.disabled);
            elem.bind('click', function(e) {
              var switchedFunc = null;
              var clickEvent = null;
              if (!switcher.onAnimate && !scope.disabled) {
                if (e.button !== 0) {
                  return;
                }
                clickEvent = {
                  '$event': {
                    'type': 'SWITCHER_CLICK',
                    'name': 'click',
                    'target': elem,
                    'oldValue': scope.model,
                    'value': !scope.model,
                    'switched': function(callback) {
                      switchedFunc = callback;
                    }
                  }
                };

                scope.ngClick(clickEvent);
                switcher.switch(scope.model, function(value) {
                  scope.$apply(function() {
                    scope.model = value;
                    if (switchedFunc !== null) {
                      switchedFunc.call(clickEvent, value, !value);
                    }
                  });
                });
              }
            });

            scope.$watch('disabled', function(value, oldValue) {
              if (value != oldValue) {
                switcher.disabled(value);
                switcher.switch(!scope.model, function(newValue) {
                  scope.$apply(function() {
                    scope.model = newValue;
                  });
                });
              }
            });

            scope.$watch('model', function(value, oldValue) {
              if (value !== oldValue && !scope.disabled) {
                scope.ngChange({
                  '$event': {
                    'type': 'SWITCHER_CHANGE',
                    'name': 'change',
                    'target': elem,
                    'oldValue': oldValue,
                    'value': value
                  }
                });
                switcher.switch(oldValue);
              }
            });

          });
        });
      }
    };
  };

  ng.module('ntd.directives')
  .directive('adminuiSwitcher', ['$timeout', SwitcherDirective]);
})(angular);

@@ -2748,32 +2748,66 @@
 ckEvent = null;%0A
+              var isStop = false;%0A
               if
@@ -3300,16 +3300,123 @@
 llback;%0A
+                    %7D,%0A                    'stopSwitch': function() %7B%0A                      isStop = true;%0A
         
@@ -3512,16 +3512,49 @@
 Event);%0A
+                if (!isStop) %7B%0A  
         
@@ -3618,32 +3618,34 @@
                 
+ 
+ 
 scope.$apply(fun
@@ -3646,32 +3646,34 @@
 ly(function() %7B%0A
+  
                 
@@ -3713,24 +3713,26 @@
             
+  
 if (switched
@@ -3762,32 +3762,34 @@
                 
+ 
+ 
 switchedFunc.cal
@@ -3830,34 +3830,38 @@
                 
-%7D%0A
+  %7D%0A  
                 
@@ -3874,36 +3874,87 @@
                 
+ 
+ 
 %7D);%0A
+                %7D%0A                isStop = true;%0A
               %7D%0A

fix switcher