How do you disable the submit button after a single click to prevent multiple submissions in Angularjs?

前端 未结 10 2141
礼貌的吻别
礼貌的吻别 2020-12-23 14:35

I\'ve looked all over the web including several stack overflow examples for a solution to the question. To be specific, I tried this:

10条回答
  •  孤独总比滥情好
    2020-12-23 15:07

    Another way is to write a directive which disables the submit button

        angular.module('myApp').directive('clickedDisable', function(){
        return {
            restrict: 'A',
            link: function(scope, ele, attrs){
                $(ele).click(function(){
                    $(ele).attr('disabled', true);
                });
            }
        };
    

    And in the HTML

        
    

提交回复
热议问题