I am trying to get data from api and show into the table. One of the columns contains status attribute which return true or false value but I want to show Active or Block buttons instead of this status, ie. if status is true then show delete button and if status==false show active button. How can I able to achieve this in angular 2.
You could probably do something like this:
considering status:boolean=true;
in your template you can use *ngIf as:
<div>
<button *ngIf="status==true">Delete</button>
<button *ngIf="status==false">Active</button>
</div>
or you could also use ngSwitch
too.
Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.