Reputation: 612
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
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
Reputation: 254
@Component({
selector: '',
templateUrl : '',
providers : [CallNumber]
Upvotes: 1
Reputation: 222582
Add as a provider inside app.module.ts
providers: [
CallNumber,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
Upvotes: 3
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