Hide/show individual items inside ngFor

后端 未结 6 644
独厮守ぢ
独厮守ぢ 2020-11-28 08:31

I need to show / hide part of component. Here is Angular2 example.

  • 6条回答
    •  日久生厌
      2020-11-28 09:36

      In HTML: (click)="onClick($event)"

      Inside de function onClick, you can catch the event and use it like a jquery object, like this:

      onClick(event){
         $(event.target).siblings('div').toggle(500);
      }
      

      In this example, I search for the sibling of my target object, you could do that with any object you need.

    提交回复
    热议问题