1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-10 21:24:20 +01:00
fab-manager/app/assets/javascripts/directives/stripe-angular.js
2018-11-21 11:08:53 +01:00

24 lines
716 B
JavaScript

'use strict';
// https://github.com/gtramontina/stripe-angular
Application.Directives.directive('stripeForm', ['$window',
function ($window) {
var directive = { restrict: 'A' };
directive.link = function (scope, element, attributes) {
var form = angular.element(element);
form.bind('submit', function () {
var button = form.find('button');
button.prop('disabled', true);
$window.Stripe.createToken(form[0], function () {
var args = arguments;
scope.$apply(function () {
scope[attributes.stripeForm].apply(scope, args);
});
// button.prop('disabled', false);
});
});
};
return directive;
}]);