javascript - Angular2 - *ngIf : How to show a specific element? -


i willing show specific element using ngif; however, reason, not work.

the issue: when click show specific element, other elements shows up!

the code:

html (elements taken async request)

<ion-col *ngfor="#finalformat of elements"> <div *ngif="currentelement"> <div>show element</div> </div> <div (click)="showthis(finalformat.elementname)" *ngif="!currentelement">click show</div></ion-col> 

js:

    showthis(element){     if(this.currentelement === element){       return;     }     this.currentelement = element;     } 

i update test this:

<div *ngif="currentelement === finalformat.elementname">   (...) </div> 

same "click show" block:

<div (click)="showthis(finalformat.elementname)"       *ngif="!currentelement !== finalformat.elementname">   click show </div> 

Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -