Reputation: 7
I am using Cordova PayPal plugin. But, when I am trying to add it to a page, I am getting the following error :
Uncaught (in promise): Error: No provider for PayPal! Error: No provider for PayPal! at injectionError (http://localhost:8100/build/main.js:1510:86) at noProviderError (http://localhost:8100/build/main.js:1548:12) at ReflectiveInjector_.throwOrNull (http://localhost:8100/build/main.js:3049:19) at ReflectiveInjector.getByKeyDefault (http://localhost:8100/build/main.js:3088:25) at ReflectiveInjector.getByKey (http://localhost:8100/build/main.js:3020:25) at ReflectiveInjector.get (http://localhost:8100/build/main.js:2889:21) at AppModuleInjector.get (ng:///AppModule/module.ngfactory.js:358:125) at AppModuleInjector.getInternal (ng:///AppModule/module.ngfactory.js:507:55) at AppModuleInjector.NgModuleInjector.get (http://localhost:8100/build/main.js:3856:44) at resolveDep (http://localhost:8100/build/main.js:11318:45) Stack
any ideas? also, do you have any suggestion for understanding providers and promises?
Upvotes: 0
Views: 860
Reputation: 2132
In your app.module.ts, add the followings
import { PayPal, PayPalPayment, PayPalConfiguration } from '@ionic-native/paypal';
Under @NgModule section, look for providers and add 'Paypal' as shown below :
providers:[ PayPal ]
Upvotes: 1