Note: As this tutorial is for Ionic 1.x apps. As Ionic has evolved to Ionic 2 i have written another tutorial for Dialing a number in Ionic 2 here.
Watch Video Tutorial Of This Post Here:
Firstly we will do the usual and create a new ionic project you can work with an existing one, so write the following in the command prompt
ionic start makePhoneCall sidemenu
Now we need to do to prepare a button pressing which we will dial a number.
<a href="tel:+1-1800-555-5555" class="button button-positive">Call me</a>
Make sure that you use this particular format of creating a button to make it work. The thing to note here is that this works with the href attribute so any element that takes the href attribute will work.
Allow access in the config.xml file by adding the following
<access origin="tel:*" launch-external="yes"/>
And that’s it. Now you can dial numbers using your ionic app.
FOR USSD CODE:
USSD code has
# in it, when you use the normal way as shown above the
# is removed. So to have USSD codes you need to encode them, meaning replace every occurrence of
%23. For USSD code to work instead of using the following
<a href="tel:+123#456-789" class="button button-positive">Call me 2</a>
You can use this
<a href="tel:+123%23456-789" class="button button-positive">Call me 2</a>
Note: A thing to note here is that if you are using a hybrid app to make a call using your app when u click the dial button the number will appear “Typed in” the dial pad the user still has to tap the call button in the phone’s dialer.
Leave Me Your Questions And Feedback