显示mailto链接到angularjs中的名称

时间:2016-06-26 09:16:29

标签: angularjs

我正在开发AngularJs应用程序,我需要在其中显示客户名称,但是应该通过邮件将邮件链接到他的电子邮件地址。 例如:如果名称为Bob且电子邮件为bob@a.com,则点击Bob时应显示邮件至bob@a.com

我的html如下

<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>

我有电子邮件属性。它的groupObj.accountExecutiveEmail。我如何在HTML中执行此操作?

5 个答案:

答案 0 :(得分:2)

您可以在模板中添加以下内容:

 <a ng-href="mailto:{{groupObj.accountExecutiveEmail}}" target="_blank">
     {{groupObj.accountExecutiveName}} --> here will be the item's name
 </a>

答案 1 :(得分:2)

<{1}}标记中的

mailto:是可行的方式。

https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Email_links

<a>

答案 2 :(得分:2)

以下代码适用于您的情况:

sh

所以你的最终HTML将如下所示:

ch

干杯!

答案 3 :(得分:1)

只需使用mailto链接

即可
<a ng-href="mailto:{{groupObj.accountExecutiveEmail}}">Send email</a>

答案 4 :(得分:0)

Angular2 +:

int[] arr = new int[]{1, 2, 3};
//int[] arr = new int[]{1, 2, 3, 4};
//int[] arr = new int[]{1, 2, 3, 4, 5};

GapArray ca = new GapArray(arr);

boolean aTurn = true;
int aScore = 0;
int bScore = 0;

while (ca.size() > 0)
{
    int point;
    int size = ca.size();
    int middle;
    if (size % 2 == 0)
    {
        middle = size / 2;

        if (ca.get(middle - 1) > ca.get(middle))
        {
            point = ca.remove(middle - 1);
        }
        else
        {
            point = ca.remove(middle);
        }
    }
    else
    {
        point = ca.remove(size / 2);
    }
    if (aTurn)
    {
        aScore += point;
        aTurn = false;
    }
    else
    {
        bScore += point;
        aTurn = true;
    }
}
if (aScore == bScore)
{
    System.out.println("Person_A 0");
}
else if (aScore > bScore)
{
    System.out.println("Person_A " + (aScore - bScore));
}
else
{
    System.out.println("Person_B " + (bScore - aScore));
}