Angular ngClass value from component

44 views Asked by At

I have the following codes for my [ngClass]. What I want is consultant-rating-selected-1 + iconLanguage where by the iconLanguage was pass from the component itself. Eg. consultant-rating-selected-1_A. But this syntax keep giving me error. May I know what is the correct syntax?

<label [ngClass]="rating.Service == '4' ? 'consultant-rating consultant-rating-selected-1' + {{iconLanguage}} : 'consultant-rating consultant-rating-1' + {{iconLanguage}}" for="consultant-1"></label>
1

There are 1 answers

0
Lalit Bansal On

use iconLanguage without curley braces.

<label [ngClass]="rating.Service == '4' ? 'consultant-rating consultant-rating-selected-1' + iconLanguage : 'consultant-rating consultant-rating-1' + iconLanguage" for="consultant-1"></label>