Calling method on ngIf conditions


#1

Is it possible to call a method only when a condition in ng-if is true?


#2

Can you please explain the scenario? Or share the piece of code


#3

I have a list with many objects. The objects are of different types like contacts, images, files etc.
When it is a image i want to call a method to download it


#4

How you are going to get the data to your UI? Please share code


#5

Are you looking to perform this action as part of a click?

If so, you can do the following, I do this on my ion-cards

<ion-card (click)=" isImage ? doImageFunction(anyImageData) : ‘’">

bind to the click event and check if the item is an image, if not, do nothing.