Sithys
Sithys

Reputation: 3793

Angular 4 - Only show image when src is set

in my component.html i got <img [src]="terminalImage" width="15%"> so i want an image to be displayed after the user has used the search function. But now, when he enters the /search route, he sees this, till he used the search:

enter image description here

So i need the image to be hidden or sth. like that, till the user has used the search function and [src] is filled.

Upvotes: 0

Views: 58

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222572

Juse use *ngIf

<img *ngIf="terminalImage" [src]="terminalImage" width="15%">

Upvotes: 4

Related Questions