Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No provider for CallNumber in ionic 3

I am using ionic 3, I want to call a number and for that I have added ionic native plugin for call-number:

ionic cordova plugin add call-number
npm install --save @ionic-native/call-number

But it's throwing an error:

ERROR Error: Uncaught (in promise): Error: No provider for CallNumber!

like image 495
virender nehra Avatar asked Nov 25 '17 09:11

virender nehra


2 Answers

You also need to add CallNumber in the providers array of your AppModule (located in the app.module.ts file):

// ...
import { CallNumber } from '@ionic-native/call-number';

@NgModule({
  declarations: [..],
  imports: [...],
  bootstrap: [IonicApp],
  entryComponents: [...],
  providers: [
    CallNumber, // <--- Here! :)
    ...
    ...
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}
like image 181
sebaferreras Avatar answered Oct 25 '22 11:10

sebaferreras


Add as a provider inside app.module.ts

providers: [
    CallNumber, 
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
like image 34
Sajeetharan Avatar answered Oct 25 '22 09:10

Sajeetharan