Issue
I have been trying to conditionally align some text with ngStyle, but unsuccessfully thus far.
Here’s the code I’ve developed so far:
<div [ngStyle]="{'display':totalRegisters<=10 ? 'inline-block; text-align: right; width: 100%' : null}">
If someone can help out, I’d much appreciate it
Solution
I think you should use ngClass
.
- Place your alignment style into css class
- Use
ngClass
, example :<div [ngClass]="{'my-class': totalRegisters <= 10}">
More on Angular documentation