Reputation: 1212
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>
Upvotes: 3
Views: 684
Reputation: 1212
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.
Upvotes: 0
Reputation: 744
its simple to access calling in ionic app.
<a class="item item-icon-left " ng-href="tel:91xxxxxxxx" >call:91xxx</a>
the above code is fine but we want to add access permission in config file
<access origin="tel:*" launch-external="yes" />
write the code in config.xml file
Upvotes: 2
Reputation: 4714
I used OnsenUi with cordova and it worked fine for me. I will share my code with you.
Html
<ons-button modifier="large--cta" style="width:100%; background-color:lightgreen" ng-click="callNumber()">Call</ons-button>
Js
var supportPhone = "+10000000001";
$scope.callNumber = function () {
window.plugins.CallNumber.callNumber(function () {},
function (e) {
alert('error:' + e)
},
supportPhone);
};
If anyone needs some help leave a comment.
Happy Coding. -Charitha-
Upvotes: 0