I'm reading through this tutorial on integrating stripe elements with Angular and I'm just curious as to why the onChange
method calls detectChanges()
at the end. The onChange
method is added as an event listener to the stripe card and will assign an error if onChange
receives one.
onChange({ error }) {
if (error) {
this.error = error.message;
} else {
this.error = null;
}
this.cd.detectChanges();
}