I have json:
[{ "nodename": "Main application Server", "enabled": true }, { "nodename": "Main Server", "enabled": false }]
and I will show this data in my template using ngFor:
<div class="row" *ngFor="let list of lists"> <div class="col-md-12 col-xs-12"> <div class="panel panel-primary"> <div class="panel-heading"> <h2 class="panel-title text-center">Server: {{ list.nodename }}, {{ list.enabled }}</h2> </div> </div> </div> <div>
And now I would set a different color in my panel-primary in the template: if "enabled": true , than set green, and if "enabled": false , set red. How to do it? with ngIf=... ? Or something else?
source share