0

I have a routine that sets a list of links, some of them have the property of "isDownload". I cant figure out how to set something like this

<a (display download attribute if the element contains the property of isDownload)> anchor info</a>

I can do something like this:

<a *ngIf="item.isDownload" .... download>anchor info</a>

<a *ngIf="!item.isDownload" ...>anchor info</a>

however I would like to have it all in one line but I can't figure out how simply display "download" if a criteria is met. I know I can do something like [download]={{"item.isDownload" ? true: false}} but that just set the value of "download" to true or false and since it is the download property it will try to download a file rather than just ignore it.

jabaa
  • 5,844
  • 3
  • 9
  • 30
Helmut Granda
  • 4,565
  • 7
  • 35
  • 51
  • 3
    https://stackoverflow.com/questions/36745734/how-to-add-conditional-attribute-in-angular-2 – Petr Averyanov Oct 06 '21 at 02:59
  • Thanks @PetrAveryanov, I thought I had look "everywhere" for this but could not find it. I will set this as duplicate as soon as the system allows me to. – Helmut Granda Oct 06 '21 at 13:21

0 Answers0