Currently learning about integrating stripe elements with Angular and I'm intrigued by the use of the onChange
method that calls detectChanges()
at the end. The onChange
function acts as an event listener for the stripe card, checking for errors upon change in input.
onChange({ error }) {
if (error) {
this.error = error.message;
} else {
this.error = null;
}
this.cd.detectChanges();
}