richnologies / ngx-stripe

Angular 6+ wrapper for StripeJS
MIT License
221 stars 75 forks source link

[BUG] #225

Closed gregoiregentil closed 1 year ago

gregoiregentil commented 1 year ago

With both version 14 and 16, I get the same bug as #99 (https://github.com/richnologies/ngx-stripe/issues/99)

ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(HomePageModule)[StripeService -> StripeService -> StripeService]: NullInjectorError: No provider for StripeService! NullInjectorError: R3InjectorError(HomePageModule)[StripeService -> StripeService -> StripeService]: NullInjectorError: No provider for StripeService! at NullInjector.get (core.mjs:8853:27) at R3Injector.get (core.mjs:9292:33) at R3Injector.get (core.mjs:9292:33) at R3Injector.get (core.mjs:9292:33) at ChainedInjector.get (core.mjs:13981:36) at lookupTokenUsingModuleInjector (core.mjs:4484:39) at getOrCreateInjectable (core.mjs:4532:12) at Module.ɵɵdirectiveInject (core.mjs:11764:19) at NodeInjectorFactory.IdentityComponent_Factory [as factory] (identity.component.ts:10:31) at getNodeInjectable (core.mjs:4738:44) at resolvePromise (zone.js:1193:31) at resolvePromise (zone.js:1147:17) at zone.js:1260:17 at _ZoneDelegate.invokeTask (zone.js:402:31) at core.mjs:10715:55 at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:10715:36) at _ZoneDelegate.invokeTask (zone.js:401:60) at Object.onInvokeTask (core.mjs:11028:33) at _ZoneDelegate.invokeTask (zone.js:401:60) at Zone.runTask (zone.js:173:47)

My code is:

import { Component } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { StripeService } from 'ngx-stripe';

@Component({ selector: 'ngstr-identity', templateUrl: './identity.component.html' })

export class IdentityComponent {

constructor(private httpClient: HttpClient, private stripeService: StripeService) {}

verify() { this.httpClient.post("identity.json", "", { headers:{"content-type": "application/x-www-form-urlencoded"} }).subscribe((response) => { return this.stripeService.verifyIdentity(response["ephemeral_key_secret"]); }, (error) => { alert(error); }); }

}

Am I doing something wrong or is there still a problem in ngx-stripe?

gregoiregentil commented 1 year ago

I'm sorry to have missed the title of the bug (I'm surprised that github let me file the bug without it). But it seems that I can't modify the title of the bug.

gregoiregentil commented 1 year ago

I'm closing this one and re-opening a new one with a title.