Closed einewton closed 7 years ago
Ok, I fixed this by taking out the card setup code (this.stripeService.elements) from ngOnInit and putting it into ngAfterViewInit.
About the other concerns, you can remove the ElementRef and pass the selector id to the mount call:
this.card.mount('#card-element')
So no more cardRef, no ElementRef and no nativeElement
Thanks for the fix with ngAfterViewInit. I will update the readme tomorrow.
Hello,
When I go to the view with the this.card.mount() and go away from the view, then return to that view again I get the following error:
Line 154 is this line from your example: this.card.mount(this.cardRef.nativeElement);
The nativeElement is a property for the cardRef using the angular ElementRef and When reading about it, they say:
Should you be using something else, or a better way of doing this?
When looking at that reference document that I linked above (and here) it shows a security issue, and being a payment I feel this should be top priority to find a better way than using ElementRef.. Here is the note from Angular.IO
Security Risk
Permitting direct access to the DOM can make your application more vulnerable to XSS attacks.