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

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -