angular.module('ui.knob', [])
  .directive('knob', function () {
    return {
      restrict: 'EACM',
      template: function(elem, attrs){

        return '<input value="{{ knob }}">';

      },
      replace: true,
      scope: true,
      link: function (scope, elem, attrs) {

        scope.knob = scope.$eval(attrs.knobData);

        var renderKnob = function(){

          scope.knob = scope.$eval(attrs.knobData);

          var opts = {}; 
          if(!angular.isUndefined(attrs.knobOptions)){
            opts = scope.$eval(attrs.knobOptions);
          }

          if(!angular.isUndefined(attrs.knobMax)){
            var max = scope.$eval(attrs.knobMax);
            if(!angular.isUndefined(max)){

              opts.max = max;
            
            }
          }
          
          $elem = $(elem);
          $elem.val(scope.knob);
          $elem.change();
          $elem.knob(opts);

        };

        scope.$watch(attrs.knobData, function () {
           renderKnob();
        });

        scope.$watch(attrs.knobOptions, function () {
          renderKnob();
        }, true);

      }
    };
  });
@@ -926,72 +926,357 @@
     
-scope.$watch(attrs.knobData, function () %7B%0A           renderKnob
+var updateMax = function updateMax() %7B%0A          var max = scope.$eval(attrs.knobMax);%0A          $elem.trigger('configure', %7B%0A            'max': max%0A          %7D).trigger('change');%0A        %7D%0A%0A        scope.$watch(attrs.knobData, function () %7B%0A           renderKnob();%0A        %7D);%0A%0A        scope.$watch(attrs.knobMax, function() %7B%0A          updateMax
 ();%0A

Fix for refreshing the max amount of the knob when the max value its bound to is changed