0

I have a link and would like to add the rel=nofollow only on specific link.

It is possible to do that with Angular?

Raphaël Balet
  • 6,334
  • 6
  • 41
  • 78

2 Answers2

0

TLDR

[rel]="i ? 'nofollow' : null

Why

Basically, When using the null value, the tag will just be ignored.

Raphaël Balet
  • 6,334
  • 6
  • 41
  • 78
0

Can you please try like this

<a [attr.rel]="addNofollowAttribute ? 'nofollow' : null" href="https://example.com">Your Link</a>

In this example, [attr.rel] binds the rel attribute to the value 'nofollow' when addNofollowAttribute is true, and it binds it to null (which effectively removes the rel attribute) when addNofollowAttribute is false.

Ashish Mishra
  • 571
  • 3
  • 11