I’m migrating an app to ionic 4. Calls from html worked just fine in ionic 3 with the following code:`
<a ion-button class="gl" outline color="light" href="tel:+4316800820">Taxi</a>.
In ionic 4 the following code, instead of calling a number, reverts to the default page:
<ion-button extend="block" color="light" href="tel:+4316800820">Taxi</ion-button>
The same occurs when I use “ion-anchor” instead of “ion-button”.
How to create a link/button in ionic 4 to call a phone?
1 Like
I am still on Ionic 3. We use the plugin https://github.com/Rohfosho/CordovaCallNumberPlugin to make calls.
It should work in Ionic 4 too because it is a native plugin.
something like this,
<a button icon-start ion-button full (click)="callSupport()">
<ion-icon name="call"></ion-icon>
<i class="icon ion-ios-telephone"></i>
<strong>3525235235235</strong>
</a>
callSupport(): void {
this.callNumber.callNumber('3525235235235', true);
}
Thanks nirman99! I’d like to try pure html because of problems with a cordova call-number plugin 2 years ago that couldn’tbe solved so the moderator recommended html.
1 Like
I use the plugin for 1 and half years and never had an issue. I was using HTML too but i wanted to dial with a pause (e.g. 18771112233,2). I was not able to do it with pure HTML and that is why I moved to the plugin.
Thanks Nirman,I may give it a try when Ionic4 is out of Beta. For the time being, I do it with plain HTML and it works with call.html being like:
<a href="tel:+4316800820">Taxi</a>
and call.scss:
a {
font-size: 18px;
font-weight: bold;
color: white;
text-decoration-color: white;
}
1 Like