richnologies / ngx-stripe

Angular 6+ wrapper for StripeJS
MIT License
219 stars 77 forks source link

wrong definition for Element.on #13

Closed rdpeake closed 6 years ago

rdpeake commented 6 years ago

Element on footprint should be

on(ev: ElementEventType, handler: (event?: any) => void): void;

as stripe documentation indicates that a parameter is passed to the handler for some of the events.

lujakob commented 6 years ago

This is apparently fixed in branch 0.3.0. The problem is this package version is not available in the NPM repository. 'npm view ngx-stripe versions' show the latest version available is 0.2.3 @richnologies Could you please make the latest version available in NPM. Thanks.

smlee commented 6 years ago

@lujakob just bind this to the callback

ex.

this.card.on('change', this.onChange.bind(this));
...
onChange(event) {
  console.log(event)
}
lujakob commented 6 years ago

@smlee Awesome, that works! Thanks.