Issue
<div *ngFor="let f of layout?.photoframes; let i = index" [attr.data-index]="i">
<input type="number" [(ngModel)]="f.x" [style.border-color]="(selectedObject===f) ? 'red'" />
</div>
the conditional style throws the error
Conditional expression (selectedObject===f) ? 'red' requires all 3 expressions at the end of the expression [(selectedObject===f) ? 'red'] what can I do?
Solution
You need also to pass the result of the case in which condition will return false
. In other words you need to pass correct ternary operator
Something like if/else
. If true
return red
, else return blue
.
(selectedObject === f) ? 'red' : 'blue'
Answered By - Suren Srapyan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.