0

I wrote the following code :

<a target="_blank"  *ngIf="value.url" [href]="value.url">{{value.data  | translate | removeHTMLTags }}</a>

My expection is to open the new entity on the new tab. I checked the value.url and is: /#/inquiry/5452

when i click on it, it seem not clickable.

At the inspect its looks: enter image description here

what im doing wrong?

im using Angular 8

Elior Sastiel
  • 1,074
  • 2
  • 10
  • 21
  • Does this answer your question? [How to open link in new tab in angular 5](https://stackoverflow.com/questions/52240123/how-to-open-link-in-new-tab-in-angular-5) – Liam Sep 16 '20 at 09:28
  • Seems that you are binding href with invalid hyperlink! /#/inquiry/5452 will not open any hyperlink in new tab. – d1fficult Sep 16 '20 at 09:49

1 Answers1

1

The problem is that /#/inquiry/5452 is not a valid URL and it expected a valid one. If you have a path like /inquiry/:id in your app-routing.module.ts, So use Angular RouterLink.

You should create something like this:

<a target="_blank"  *ngIf="value.url" [routerLink]="['inquiry', '5452']">{{value.data  | translate | removeHTMLTags }}</a>
ng-hobby
  • 2,077
  • 2
  • 13
  • 26