Issue
I currently have this code:
<div [style.width.px]="width1">
<div>Something here</div>
</div>
But I need to put a condition like:
<div *ngIf="somecondition then [style.width.px]="width1" else [style.width.px]="width2" ">something here</div>
How can I do this?
Solution
You can simply use conditional expression that will return desired value:
<div [style.width.px]="someCondition ? width1 : width2">
<div>Something here</div>
</div>