Skip to main content
added 1 character in body
Source Link
Dan Soper
  • 678
  • 8
  • 18

I normally do property binding like this:

<a [href]="myHref">Link</a>

(where myHref is a property in my Component class.)

But I've also seen

<a href="{{myHref}}">Link</a>

on the Angular website. Which I understand.

But I've also seen this:

<a href={{myHref}}>Link</a>

(without the quotations).

It works, but I can't see this exact syntax being used on the Angular website anywhere. Is it allowed?

I normally do property binding like this:

<a [href]="myHref">Link</a>

(where myHref is a property in my Component class.

But I've also seen

<a href="{{myHref}}">Link</a>

on the Angular website. Which I understand.

But I've also seen this:

<a href={{myHref}}>Link</a>

(without the quotations).

It works, but I can't see this exact syntax being used on the Angular website anywhere. Is it allowed?

I normally do property binding like this:

<a [href]="myHref">Link</a>

(where myHref is a property in my Component class.)

But I've also seen

<a href="{{myHref}}">Link</a>

on the Angular website. Which I understand.

But I've also seen this:

<a href={{myHref}}>Link</a>

(without the quotations).

It works, but I can't see this exact syntax being used on the Angular website anywhere. Is it allowed?

Source Link
Dan Soper
  • 678
  • 8
  • 18

Angular attribute/property interpolation

I normally do property binding like this:

<a [href]="myHref">Link</a>

(where myHref is a property in my Component class.

But I've also seen

<a href="{{myHref}}">Link</a>

on the Angular website. Which I understand.

But I've also seen this:

<a href={{myHref}}>Link</a>

(without the quotations).

It works, but I can't see this exact syntax being used on the Angular website anywhere. Is it allowed?