Is there a way to simplify this ngClass?
edit? - This one works finevalue ===- This is a child component. Each of the two parent components pass thevalueproperty down as an @Input. Child component 1 has areleasedproperty. Child component 2 does not have thereleasedproperty.- If the
valueisvalue1AND thereleasedproperty istrue, no class is added. However, if thereleasedproperty isfalseadd a class calledclass-3. - If the
valueisvalue2, always addclass-3as there is noreleasedproperty.
The below works, but it feels like it could be streamlined.
<div [ngClass]="[
edit ? 'class-1' : 'class-2',
value === 'value1' && released ? '' : 'class-3',
value === 'value2' ? 'class-3' : ''
]">