Submitting Braintree Form Submission to Intercept AngularJS
In a simple javascript UI, when a form is submitted, braintree.js will intercept the form submission and insert a hidden field named "payment_method_nonce" into the form before the submission is actually sent to the server.
However, using AngularJS as a frontend framework, I usually don't want the form submission to go directly to the server and then do a page reload. Instead, I want my AngularJS function to intercept and process the form submission (for example via ng-click or ng-submit), and when it is processed, it should fetch and use the "payment_method_nonce" value.
I tried it and it can still intercept the submit form. However, it looks like AngularJS is intercepting the form submission before braintree.js does and inserts the "payment_method_nonce" field.
Consequently, my AngularJS code that responds to the form submission cannot receive this "payment_method_nonce" field and process accordingly. Any suggestions on how I can get around this?
Thank!
source to share