virender nehra
virender nehra

Reputation: 612

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!

Upvotes: 6

Views: 4214

Answers (4)

Mouad Chaouki
Mouad Chaouki

Reputation: 578

Other solution by simply using

<a href="tel:+1234567890">CALL</a>

Just make sure you have below code in config.xml file

<allow-intent href="tel:*" />

Upvotes: 0

keval nayak
keval nayak

Reputation: 254

add below code in your page.ts file

@Component({
selector: '',
templateUrl : '',
providers : [CallNumber]

Upvotes: 1

Sajeetharan
Sajeetharan

Reputation: 222582

Add as a provider inside app.module.ts

providers: [
    CallNumber, 
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]

Upvotes: 3

sebaferreras
sebaferreras

Reputation: 44659

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 {}

Upvotes: 12

Related Questions