Mahajan344 Mahajan344 - 5 months ago 28
AngularJS Question

show mailto link to name in angularjs

I am working on AngularJs app where I need to show Name of customer but it should mail to link with email to his email address.
Eg : If name is

Bob
and email is
bob@a.com
, then on click of Bob it should show mail to
bob@a.com


my html as as below

<div class="form-group mg-t20" ng-hide="!groupObj.accountExecutiveName">
<label class="wd50p control-label left fw-norm">Account Executive:</label>
<div class="wd48p blue-txt">
{{groupObj.accountExecutiveName}}
</div>
</div>


I do have email property . Its
groupObj.accountExecutiveEmail
. How do i do this in html ?

Answer

The following code should work in your case:

<a ng-href="mailto:{{ groupObj.accountExecutiveEmail }}" target="_blank"> 
  {{ groupObj.accountExecutiveName }}
</a>

So your final HTML will look like this:

<div class="form-group mg-t20" ng-hide="!groupObj.accountExecutiveName">
    <label class="wd50p control-label left fw-norm">Account Executive:</label>
    <div class="wd48p blue-txt">
        <a ng-href="mailto:{{ groupObj.accountExecutiveEmail }}" target="_blank"> 
        {{ groupObj.accountExecutiveName }}
        </a>
    </div>
</div>

Cheers!

Comments