javascript - In angular 4how to use tel: in a *ngHref - Stack Overflow

I am using angular 4 and in template (.html), I coded as<a *ngHref="tel:{{orders.billing_addres

I am using angular 4 and in template (.html), I coded as

<a *ngHref="tel:{{orders.billing_address.telephone}}"> <span> Call : </span>

It throws an error as

Can't bind to 'href' since it isn't a known native property a

I search it and get angular 4 use [routerLink]. But I don't know how to use [routerLink] to set tel: numbers. Could you please guide me.

I am using angular 4 and in template (.html), I coded as

<a *ngHref="tel:{{orders.billing_address.telephone}}"> <span> Call : </span>

It throws an error as

Can't bind to 'href' since it isn't a known native property a

I search it and get angular 4 use [routerLink]. But I don't know how to use [routerLink] to set tel: numbers. Could you please guide me.

Share edited Sep 15, 2017 at 13:12 mxr7350 1,4583 gold badges22 silver badges30 bronze badges asked Sep 15, 2017 at 13:06 Tamil Selvan CTamil Selvan C 20.3k12 gold badges54 silver badges71 bronze badges 1
  • Please visit angular.io/api/router/RouterLink – Ramesh Rajendran Commented Sep 15, 2017 at 13:15
Add a ment  | 

2 Answers 2

Reset to default 4

Just href inside []. It will let you to remove {{}} part. And if you want to concatenate strings inside, you need to create a string like 'tel:' + otherParts

<a [href]="'tel:' + orders.billing_address.telephone"> <span> Call : </span>

use the [href] in angular 2

<a [href]="'tel:'+ orders.billing_address.telephone"> <span> Call : </span>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745069165a4609438.html

相关推荐

  • javascript - In angular 4how to use tel: in a *ngHref - Stack Overflow

    I am using angular 4 and in template (.html), I coded as<a *ngHref="tel:{{orders.billing_addres

    15小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信