I encountered an issue with the following code snippet:
<span class="label"
ng-class="{
'label-success': resp.level == 'A1',
'label-success': resp.level == 'A2',
'label-warning': resp.level == 'B1',
'label-warning': resp.level == 'B2',
'label-danger': resp.level == 'C1',
'label-danger': resp.level == 'C2',
'label-default': resp.level == 'This word was not found',
'label-default': resp.level == 'The word level is not known'}">{[{resp.level}]}</span>
It seems that the code is not functioning properly due to multiple matches for the same option. The revised code works as intended:
<span class="label"
ng-class="{
'label-success': resp.level == 'A1',
'label-warning': resp.level == 'B1',
'label-danger': resp.level == 'C1',
'label-default': resp.level == 'The word level is not known'}">{[{resp.level}]}</span>
Questions:
- What could be causing this issue?
- Any suggestions on how to resolve it?