Skip to content

Instantly share code, notes, and snippets.

@eperedo
Created July 25, 2013 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eperedo/6076503 to your computer and use it in GitHub Desktop.
Save eperedo/6076503 to your computer and use it in GitHub Desktop.
Directive for ladda buttons
'use strict';
angular.module('buttonsApp').directive('ladda', ['$timeout', function ($timeout) {
return {
restrict: 'A',
scope: {
stop: '=stop'
},
link: function postLink(scope, element, attrs) {
var l = Ladda.create(element[0]);
element.context.form.onsubmit = function(e) {
l.start();
};
scope.$watch('stop', function(newVal) {
if (angular.isDefined(newVal)) {
if (newVal) {
l.stop();
}
}
});
}
};
}]);
@ProLoser
Copy link

ProLoser commented Aug 1, 2013

Checkout my fork (untested) which should be an easier to use implementation https://gist.github.com/ProLoser/6136208

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment