diff --git a/bower.json b/bower.json index 99fc8eb..5c8c0bf 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-ladda", - "version": "0.3.1", + "version": "0.3.2", "homepage": "https://github.com/remotty/angular-ladda", "authors": [ "Chungsub Kim " diff --git a/dist/angular-ladda.js b/dist/angular-ladda.js index 558d067..5059208 100644 --- a/dist/angular-ladda.js +++ b/dist/angular-ladda.js @@ -73,6 +73,13 @@ } if(!ladda.isLoading()) { ladda.start(); + if( element.attr('data-keep-enabled') ) { + if (attrs.ngDisabled) { + element.attr('disabled', scope.$eval(attrs.ngDisabled)); + } else { + element.removeAttr('disabled'); + } + } } if(angular.isNumber(loading)) { ladda.setProgress(loading); diff --git a/dist/angular-ladda.min.js b/dist/angular-ladda.min.js index 9f645d5..54a729d 100644 --- a/dist/angular-ladda.min.js +++ b/dist/angular-ladda.min.js @@ -1,2 +1,2 @@ /*! angular-ladda 0.3.1 */ -!function(e,t){"use strict";if("function"==typeof define&&define.amd)define(["angular","ladda"],t);else{if("undefined"==typeof module||"object"!=typeof module.exports)return t(e.angular,e.Ladda);module.exports=t(require("angular"),require("ladda"))}}(this,function(e,t){"use strict";var a="angular-ladda";return e.module(a,[]).provider("ladda",function(){var t={style:"zoom-in"};return{setOption:function(a){e.extend(t,a)},$get:function(){return t}}}).directive("ladda",["ladda",function(a){return{restrict:"A",priority:-1,link:function(n,d,r){if(d.addClass("ladda-button"),e.isUndefined(d.attr("data-style"))&&d.attr("data-style",a.style||"zoom-in"),!d[0].querySelector(".ladda-label")){var i=document.createElement("span");i.className="ladda-label",e.element(i).append(d.contents()),d.append(i)}var l=t.create(d[0]);n.$watch(r.ladda,function(t){return t||e.isNumber(t)?(l.isLoading()||l.start(),void(e.isNumber(t)&&l.setProgress(t))):(l.stop(),void(r.ngDisabled&&d.attr("disabled",n.$eval(r.ngDisabled))))})}}}]),a}); \ No newline at end of file +!function(e,a){"use strict";if("function"==typeof define&&define.amd)define(["angular","ladda"],a);else{if("undefined"==typeof module||"object"!=typeof module.exports)return a(e.angular,e.Ladda);module.exports=a(require("angular"),require("ladda"))}}(this,function(e,a){"use strict";var t="angular-ladda";return e.module(t,[]).provider("ladda",function(){var a={style:"zoom-in"};return{setOption:function(t){e.extend(a,t)},$get:function(){return a}}}).directive("ladda",["ladda",function(t){return{restrict:"A",priority:-1,link:function(d,n,r){if(n.addClass("ladda-button"),e.isUndefined(n.attr("data-style"))&&n.attr("data-style",t.style||"zoom-in"),!n[0].querySelector(".ladda-label")){var i=document.createElement("span");i.className="ladda-label",e.element(i).append(n.contents()),n.append(i)}var l=a.create(n[0]);d.$watch(r.ladda,function(a){return a||e.isNumber(a)?(l.isLoading()||(l.start(),n.attr("data-keep-enabled")&&(r.ngDisabled?n.attr("disabled",d.$eval(r.ngDisabled)):n.removeAttr("disabled"))),void(e.isNumber(a)&&l.setProgress(a))):(l.stop(),void(r.ngDisabled&&n.attr("disabled",d.$eval(r.ngDisabled))))})}}}]),t}); \ No newline at end of file diff --git a/src/angular-ladda.js b/src/angular-ladda.js index 4936eab..c01ec04 100644 --- a/src/angular-ladda.js +++ b/src/angular-ladda.js @@ -72,6 +72,13 @@ } if(!ladda.isLoading()) { ladda.start(); + if( element.attr('data-keep-enabled') ) { + if (attrs.ngDisabled) { + element.attr('disabled', scope.$eval(attrs.ngDisabled)); + } else { + element.removeAttr('disabled'); + } + } } if(angular.isNumber(loading)) { ladda.setProgress(loading); diff --git a/test/app/index.html b/test/app/index.html index b81a532..f312f34 100644 --- a/test/app/index.html +++ b/test/app/index.html @@ -67,6 +67,7 @@ ng-if true + open modal