I am trying to make an ons-button using ng-click to dial a number when it is clicked, in both iOS & Android. I use Cordova framework.
I have used the followings but with no success:
<ons-button ng-click="window.open('tel: {{69000000}}', '_system')">Call</ons-button>
<ons-button ng-click="window.location.href('tel: {{69000000}}', '_system')">Call 2</ons-button>
In config.xml I have enabled
<access origin="tel:*" launch-external="yes" />
I was actually using a href for a long time, but that causes a bunch of css trouble. I found this plugin to be a big help putting the dialer in a ons-button.
https://build.phonegap.com/plugins/328
In my js I had
$scope.dial = function(){
phonedialer.dial(
"9561234567",
function(err) {
if (err == "empty") alert("Unknown phone number");
else alert("Dialer Error:" + err);
},
function(success) { alert('Dialing succeeded'); }
);
}
and in my html I had
<ons-button style="font-size: 24px;" modifier="large" ng-click="dial()">Phone</ons-button>
alternatively, you can adjust the alerts, or remove them all togeter.