我正在使用 angular 4,在模板 (.html) 中,我编码为
<a *ngHref="tel:{{orders.billing_address.telephone}}"> <span> Call : </span>
它抛出一个错误作为
Can't bind to 'href' since it isn't a known native property a
我搜索它并获得 angular 4 使用 [routerLink]。但是我不知道如何使用 [routerLink] 来设置 tel: numbers。你能指导我吗?
最佳答案
只是 []
中的 href
。它会让您删除 {{}}
部分。如果你想在里面连接字符串,你需要创建一个像 'tel:' + otherParts
<a [href]="'tel:' + orders.billing_address.telephone"> <span> Call : </span>
关于javascript - 在 Angular 4 中如何使用电话 : in a *ngHref,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46240335/