Guest User

Untitled

a guest
Mar 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. $scope.TestFunc = function () {
  2.  
  3. alert("TestFunc called");
  4. }
  5.  
  6. <button class="btn btn-default btn-column" print-button-spinner test="TestFunc()" >
  7. test
  8. </button>
  9.  
  10. App.directive('printButtonSpinner', function() {
  11. return {
  12. scope:
  13. {
  14. docType: '@',
  15. test: '&'
  16. },
  17.  
  18. restrict: 'A',
  19.  
  20. link: function (scope, element) {
  21. var printFunc = scope.test();
  22. element.bind('click', printFunc);
  23. }
  24. };
  25. });
  26.  
  27. TypeError: eventFns[i] is undefined
  28. eventFns[i].call(element, event);
  29.  
  30. var printFn = function (docType, element) {/*some code*/}
  31.  
  32. <button class="btn btn-default btn-column" print-button-spinner doc-type="zebraCurLabels" print="printFn(docType, null)">
  33. </button>
  34.  
  35. App.directive('printButtonSpinner', function() {
  36. return {
  37. scope:
  38. {
  39. docType: '@',
  40. print: '&'
  41. },
  42.  
  43. restrict: 'A',
  44.  
  45. link: function (scope, element) {
  46. var print = scope.test;
  47. element.bind('click', print(scope.docType, element));
  48. }
  49. };
  50. });
  51.  
  52. TypeError: eventFns[i] is undefined
  53. eventFns[i].call(element, event);
  54.  
  55. element.bind('click', function(){
  56. print(scope.docType, element);
  57. });
Add Comment
Please, Sign In to add comment