No Provider Error

It seems that whenever I install a plugin that is called from ‘@ionic-native/example-plugin’ I get a No Provider run-time error.

Am I doing something wrong? I am copying straight from the docs.

@jake_b You need to add the plugin to the providers list of the NgModule:

Example with Clipboard:

import { Clipboard } from '@ionic-native/clipboard';

...

@NgModule({
	imports: ...,
	exports: ...,
	providers: [
		...
		Clipboard,
		...
	]
})
1 Like

Thank you very much, all fixed.

Can I just install in ‘ionic-native’ to avoid having to do this or does it vary between plugins? Seems like I’ve created extra unnecessary work for myself.

Each plugin needs to be added to NgModule. But, you only have to install it in the app.module.ts once. The goal of the switch to this new method is to reduce the footprint of Ionic Native in your app. Do you need the code for all 130+ plug ins? I doubt it

Thanks for clearing it up. I was wondering if it was the location of plugins that caused me to need to do this, as I’m using LocalNotifications but I did not need to add it to app.module.ts to make it work.