简体   繁体   中英

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

Href = "tel" is not working on ionic 3 and this is my code

<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. 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

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

and in .ts write this

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

Must work in ios and android

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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