Phone calling in controllers

Hi all,

I’ve been trying to call a phone number from controller code.
I could just use the new ‘tel’ hrefs but I need a validation step before calling.

Basically my calling function is like this;

function callNumber(popupTitle, popupMessage, telNumber) {
        var confirmPopup = $ionicPopup.confirm({
            title: popupTitle,
            template: popupMessage
        });
        confirmPopup.then(function (res) {
            if (res) {
                $window.open("tel:" + telNumber);
            } else {
                return false;
            }
        });
    }

which works fine in normal browser. But when I deploy my application to my mobile, it doesn’t do anything.
Are there any simpler ways to trigger a native phone call to a predetermined phone number?

Thanks,

Continuing the discussion from Making Phone Call from App - href=“tel:123”:

1 Like