ionic 3 中没有 CallNumber 的提供者 [英] No provider for CallNumber in ionic 3
本文介绍了ionic 3 中没有 CallNumber 的提供者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 ionic 3,我想拨打一个号码,为此我为 call-number 添加了 ionic 本机插件:
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
但它抛出了一个错误:
ERROR 错误:未捕获(承诺中):错误:没有 CallNumber 的提供者!
ERROR Error: Uncaught (in promise): Error: No provider for CallNumber!
推荐答案
您还需要在 AppModule
providers 数组中添加 CallNumber
>(位于 app.module.ts
文件中):
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 {}
这篇关于ionic 3 中没有 CallNumber 的提供者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文