In angular 4how to use tel: in a *ngHref

2.8k views Asked by At

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.

2

There are 2 answers

0
Suren Srapyan On BEST ANSWER

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>
0
Sachila Ranawaka On

use the [href] in angular 2

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