gpt4 book ai didi

angularjs - 如何避免添加前缀 “unsafe” 到 Angular-2 链接?

转载 作者:太空狗 更新时间:2023-10-29 17:45:38 24 4
gpt4 key购买 nike

<分区>

我正在使用 angular2ionic 2 开发移动应用程序,我有 3 个 buttons 用于 call, smsemail 如下

          <a ion-button href="tel:{{contact.cellphone}}" color="primary">
<ion-icon name="call"></ion-icon>
Call
</a>
<a ion-button href="sms:{{contact.cellphone}}" color="secondary">
<ion-icon name="text"></ion-icon>
SMS
</a>
<a ion-button href="mailto:{{contact.email}}" color="dark">
<ion-icon name="mail"></ion-icon>
Email
</a>

Callemail 工作正常,但不是 sms,似乎 angular 添加了 unsafe: in-在我的表情前面,它会变成下面这样

<a color="secondary" ion-button="" ng-reflect-color="secondary" class="button button-md button-default button-default-md button-md-secondary" ng-reflect-href="unsafe:sms:+16475374201" href="unsafe:sms:+16475374201"><span class="button-inner">

连我都试过了

      <a ion-button [attr.href]="'sms:'+contact.cellphone" color="secondary">
<ion-icon name="text"></ion-icon>
SMS
</a>

还是一样的问题,

当我不使用 Angular 绑定(bind)时它工作正常,例如这样

          <a ion-button href="sms:+1647654654" color="secondary">
<ion-icon name="text"></ion-icon>
SMS
</a>

虽然它与 Angular 有关,但我也检查了我的 config.xml 并且那里允许 sms

<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />

更新

使用@Apuu 解决方案后变成如下所示

          <a ion-button [attr.href]="'sms:'+contact.cellphone | safeUrl" color="secondary">
<ion-icon name="text"></ion-icon>
SMS
</a>

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com