简体   繁体   English

href =“tel:”不适用于离子3

[英]href=“tel:” does not work on ionic 3

Href = "tel" is not working on ionic 3 and this is my code Href =“tel”不能用于离子3,这是我的代码

<ion-item color="none" href="tel:(51) 9 9222 - 7607">
  <ion-icon name="call" item-left></ion-icon>
  Contato: {{ property.contato1 }}
</ion-item>

这是一个图像示例

I think href is available on an a , but not an ion-item element. 我认为href可用于a ,但不是ion-item元素。 So you want either: 所以你想要:

<a ion-item href="tel:..."><ion-icon>...</ion-icon></a>

or 要么

<ion-item>
    <a href="tel:..."><ion-icon>...</ion-icon></a>
</ion-item>

(In these examples, replace the ... with the appropriate content.) (在这些示例中,将...替换为适当的内容。)

call this method from your html 从你的HTML调用这个方法

<button ion-button (click)="callNumber(1236547890)">Call Number</button>

and in .ts write this 并在.ts写这个

callNumber(phoneNumber){
    window.open('tel:' + phoneNumber, '_system');
}

Must work in ios and android 必须在ios和android中工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM