angular - How to perform hide and show buttons in listview items without removing DOM in angular2 nativescript -


i need perform hide , show buttons in listview items programatically based on condition.

below have tried *ngif condition. removing dom entirely.so shows secondvisible layout buttons entirely.

html file:

// inside listview ng-template :   <button *ngif="firstvisible" row="0" col="2" text="first"> </button>   <stacklayout *ngif="secondvisible" row="0" col="2">     <button text="second" > </button>     <button text="group"  </button>  </stacklayout> 

ts file:

  if(avail == true){              this.firstvisible = true;             this.secondvisible = false;             } else {              this.firstvisible = false;             this.secondvisible = true;             } 

is there other way perform hide , show button programatically without removing dom in listview except *ngif condition.

<button [hidden]="firstvisible" row="0" col="2" text="first"> </button> 

using hidden property hide dom , not delete entirely, if want show use:

<button [hidden]="!firstvisible" row="0" col="2" text="first"> </button> 

https://angular.io/guide/ajs-quick-reference#ng-show explains more in detail


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -