In below code I want to give each answer option a different css class. Css Class should be mapped to answer 1,2,3,4 as knock1,knock2,who-s,there.
Template
<label *ngFor="let answer of answers">
<input type="radio" [(ngModel)]="selectedOption" [value]="answer.value">
{{answer.text}}
</label>
Typescript
this.answers = [
new Answer(value: 4, text: "Race"),
new Answer(value: 3, text: "Con"),
new Answer(value: 2, text: "dit"),
new Answer(value: 1, text: "ion")
];
I'm a bit rusty in Angular, so I was hoping for a hint in the right direction.
I'm currently trying out, but to no succes, in the input-tag code:
[ngClass]="{'knock1': answer.value === 1}"
inputClassproperty to theAnswerclass, and to use[ngClass]="answer.inputClass".