Roberto Flores Roberto Flores - 3 months ago 23
AngularJS Question

Make phone number clickable in angular

I am able to make the phone clickable in this way:

<a href="tel:+1-800-555-5555">Call 1-800-555-5555</a>


However, I am to grabbing phone numbers from a database and I am not sure how to make the following that is grabbing the phone clickable:

<strong>Phone:</strong> <i class="glyphicon glyphicon-earphone"></i> {{e.Phone | PhoneNumber}}


UPDATE

<div>
<nav class="hidden-xs visible-md visible-lg" ng-show="ShowResults"><uib-pagination boundary-links="true" max-size="maxPageNumbersToShow" ng-model="currentPage" total-items="resultsCount"> </uib-pagination></nav>

<nav class="visible-xs hidden-md hidden-lg" ng-show="ShowResults"><uib-pager ng-model="currentPage" total-items="resultsCount"> </uib-pager></nav>

<div class="container">
<div id="searchResults" ng-repeat="e in providers" ng-show="ShowResults">
<div class="row">
<hr />
<h4>{{e.FullName}}</h4>
</div>

<div class="row">
<div class="col-md-4 no-margin padding"><strong>Specialty: </strong>{{e.Specialty}}<br />
<span class="padding"><strong>Gender:</strong> {{e.Gender}}</span><br />
<strong>Language(s):</strong> {{e.Languages}}</div>

<div class="col-md-4 no-margin"><strong>Clinic: </strong> <i class="glyphicon glyphicon-map-marker"></i> <a href="https://maps.google.com?saddr=Current+Location&amp;daddr={{e.GoogleParams}}" target="_blank"> {{e.Address1}}</a><br />
<span class="shiftAdd padding"><a href="https://maps.google.com?saddr=Current+Location&amp;daddr={{e.GoogleParams}}" target="_blank">{{e.Address2}}</a> </span><br />
<strong>Phone:</strong> <i class="glyphicon glyphicon-earphone"></i> <a href={{e.Phone}}></a></div>
</div>
</div>
</div>
&nbsp;

<nav class="visible-xs hidden-md hidden-lg" ng-show="ShowResults">
<hr /><uib-pager ng-model="currentPage" total-items="resultsCount"> </uib-pager></nav>




Update 2

Here is what I did to determine whether phone number should be clickable:

var probablyPhone = ((/iphone|android|ie|blackberry|fennec/).test(navigator.userAgent.toLowerCase()) && 'ontouchstart' in document.documentElement);

function initialize() {
(function($) {
$('.call').css("text-decoration", "none");
$('.call').css("color", "black");
$('.call').css("cursor", "default");
})(jQuery);
}


and what is added to the tag:

<a href={{'tel:'+e.Phone}} onclick="return probablyPhone;">{{e.Phone | PhoneNumber}}</a>


Not sure why it isnt working

Any help wold be appreciated, thanks

Answer

Try

<a href={{'tel:'+e.Phone}}>{{e.Phone | PhoneNumber}}</a>