Disabled property on button
Wondering what the rationale is for setting button.prop('disabled', true) and then false. Would it not be easier to let the user handle this via ng-disabled? Use case is that I use angular-payments to generate a token and then use stripe.js to create a customer. While waiting for the response on creating the customer the button is enabled but disabled for the initial token request.
I have this problem also. I think it would be better to let the user manage the 'disabled' state of the button - what if there are other buttons on the form?. If you really want this functionality, maybe it could be controlled by some sort of option on the relevant 'button' element.
+1
so, what do you guys use to simulate this?
+1
Hey guys,
Try https://github.com/bendrucker/angular-stripe (you call it and it returns a promise instead of it calling your callback via the scope) and pair it with https://github.com/bendrucker/angular-form-state for managing submission state and syncing your submit button.
+1
So I don't know why this didn't occur to me before, but you can avoid the problem by not using a 'button' html element. Use:
<input type="submit" data-ng-disabled="processing" value="Submit" />
in the form, and set a $scope variable named 'processing' to true when the form is submitted, and to false when you get the response from your server.
The 'laurihy/angular-payments' library messes with a 'button' element, but not with an 'input' element as above.