Search code examples
cordovaionic-frameworkcordova-plugins

cordova/ionic CallNumberPlugin does not work on phone


I am trying to make call on phone using cordova/ionic.I am using CallNumberPlugin but it is not working.When i tried first time then it worked but now it is not working.It does not go to the dialer screen with number.I have tried this <a href="tel:+1-1800-555-5555" class="button button-positive">Call me</a> but no use.CallNumberPlugin is in plugin folder of the project and i am calling CallNumber.js from index page.It is Neither giving any error neither working.Can some one please help me to resolve this problem?

<ion-view class="dashboard">
    <ion-content class="top-109">

         <a href="tel: 110">call</a>

     </ion-content>
</ion-view>

Solution

  • I got the answer with the following code.

    index.html

    <ul class="list" ng-controller="PhoneCtrl">
            <li class="item">Item 1</li>
            <li class="item">Item 2</li>
            <li class="item">Item 3</li>
            <li class="item"><button ng-click="placeCall(07875509715)">Call</button></li>
          </ul>
    

    app.js

    .controller('PhoneCtrl', function($scope){
     $scope.placeCall = function(num) {
            console.log('Place Call ' + num);
            if (window.cordova) {
                cordova.InAppBrowser.open('tel:' + num, '_system');
            }
        }
    });
    

    Download the InAppBrowser plugin.