5
To jest to, co mam:przypisać styl z * ngIf oceny w angular2
home.html
<li *ngFor="let item of myList">
<div *ngIf="item.messageText === {{myVar}}" class="bordered">{{item.messageText}}</div>
<div *ngIf="item.messageText !== {{myVar}}" class="greyedOut">{{item.messageText}}</div>
</li>
w home.ts Mam zdefiniowane zmienna myVar
a ja przypisany do tego wartość.
Chcę przypisać obramowane klasy do elementu myList, który ma wartość równą myVar
i przypisać inną klasę, jeśli wartość tego elementu jest inna.
Per konwencji chcielibyśmy napisać 'szaro-out' zamiast camelCased' greyedOut' dla właściwości HTML i klas CSS. – nottinhill
Czy możesz już ustawić atrybut klasy, ale musisz dodatkowo ngClass - gdzie chcesz mieć dodatkową klasę, ale tylko wtedy, gdy jest ona prawdziwa? –