Hide and show an image with a condition

Hello everyone, I’m a student and I’m a newbie in the Ionic2 field. I’m working on a project that uses elements related to the gamification techniques: levels, rankings and badges. I want to create a profile page where the user can find his game badges, earned with the utilisation of the app. My question is: how can I show a badge only if a certain condition (for example: completing a level) is respected?

Thanks and sorry for my inaccuracies.


you have many ways of doing this

  1. user the [showWhen] attribute. Doc here

  2. Filter in your component: ie in the component class apply all the check and build the list of badge to display and pass it to the template

Thank you :slight_smile: now I’ll try!

[showWhen] is used for responsive layout, not this sort of situation. OP probably wants ngIf instead.

how can I use the responsive screen size with showWhen?

Ex: showWhen=“lg”

@rapropos, I have to say, for someone that seems to have a ridiculous amount of knowledge in the area of programming, you either get ignored or get no response quite a bit.

Sorry to see it