मैं इस json है:एनजी अगर रंग सेट करने के लिए?
[{
"nodename": "Main application Server",
"enabled": true
},
{
"nodename": "Main Server",
"enabled": false
}]
और मैं 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>
और अब, मैं टेम्पलेट में मेरी panel-primary
पर अलग रंग करने के लिए सेट होगा: अगर "enabled": true
, एक हरा रंग सेट करने से, और "enabled": false
, लाल रंग सेट करें। यह कैसे करें ngIf=...
के साथ? या कुछ और?