angular - 打开 Whatsapp 聊天号码 ionic 3/4

标签 angular ionic3 ionic4

我开发了一个应用程序,应该使用this plugin打开whatsapp聊天。 .

我使用 ionic CLI 安装它 ionic cordova 插件添加 https://github.com/ranjitpandit/whatsapp-phonegap-plugin.git其用法如下:

home.page.ts

...

declare var cordova;

...
constructor(public platform: Platform) {}

chat() {

    this.platform.ready().then(() => {

      cordova.plugins.Whatsapp.send('+263783187321');

    });

}

然后在 home.page.html 中我这样做了:

<ion-row>
    <ion-col size="12" no-padding>
      <img src="assets/imgs/chat.jpg" (click)="chat()" class="chat" />
    </ion-col>
</ion-row>

问题是,当我单击图像时,它没有打开 Whatsapp 聊天窗口。什么都没发生。请帮忙。谢谢

最佳答案

这就是 2019 年 Ionic 4 的工作方式

在config.xml中添加:

<access launch-external="yes" origin="whatsapp://*" />

在你的html中:

<a href="whatsapp://send?phone=YOUR_NUMBER">Link<a>

关于angular - 打开 Whatsapp 聊天号码 ionic 3/4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54689232/

相关文章:

angular - 如何在 Angular2 中同时使用 httpInterceptor 和 configService?

angular - 音频无法在Angular 7中播放

html - 控制*ngFor最后一项的具体样式

angular - Typescript 中的解构赋值

cordova - Ionic 3-如何在设备默认浏览器中打开外部 url

Angular "Must be imported or local"错误

angular - odoo 服务器错误日志 : Function declared as capable of handling request of type 'json' but called with a request of type 'http'

html - 如何在 ionic 4 中将 ionic 按钮居中?

angular - 如何使用 ionic-3 中的表单数据对图像文件发出发布请求

ionic4 - 如何为用户提供设置 baseurl 的选项?