touchspin.js 785 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. app.directive('touchspin', function() {
  3. return {
  4. restrict: 'EA',
  5. link: function(scope, elem, attr) {
  6. var tsOptions = [
  7. 'initval',
  8. 'min',
  9. 'max',
  10. 'step',
  11. 'forcestepdivisibility',
  12. 'decimals',
  13. 'stepinterval',
  14. 'stepintervaldelay',
  15. 'verticalbuttons',
  16. 'verticalupclass',
  17. 'verticaldownclass',
  18. 'prefix',
  19. 'postfix',
  20. 'prefix_extraclass',
  21. 'postfix_extraclass',
  22. 'booster',
  23. 'boostat',
  24. 'maxboostedstep',
  25. 'mousewheel',
  26. 'buttondown_class',
  27. 'buttonup_class'
  28. ];
  29. var options = {};
  30. for(var i = 0, l = tsOptions.length; i < l; i++) {
  31. var opt = tsOptions[i];
  32. if(attr[opt] !== undefined) {
  33. options[opt] = attr[opt];
  34. }
  35. }
  36. elem.TouchSpin(options);
  37. }
  38. };
  39. });