How to make an item of a list disappear when i click on a button


#1
<ion-list>
        <ion-item>
          <ion-thumbnail item-start>
            <img src="../../assets/imgs/etd1.jpg">
          </ion-thumbnail>
          <h2>souma</h2>
          <button ion-button color="secondary">Present</button>
          <button ion-button color="danger">Absent</button>
  </ion-item>
<ion-item></ion-item>
</ion-list>

Hi dear All , i got this code over here wich is a list of students with present and absent buttons , i wonna make every item disappear when i click on the present button
how do do that any ideas please
thank u


#2

Hello,

that seems a case for structural directive ngFor. see here https://angular.io/guide/structural-directives

Maybe you should rethink your design. If you click on button and remove the ion-item, then you remove also the buttons inside ion-item. What is, if you tapped the wrong student? Maybe sortablejs or ng-dragula is an alternative ui.

Your <img src = points maybe to src folder in your project. This folder is with ionic serve reachable, but not on device or production. Set all paths from view of index.html. In this case should src = “assets/imgs/etd1.jpg”

Best regards, Erina Nakiri


#3

thanks for your reply , i appreciate it ^^ , i will try to do so