Reputation: 1435
I am working in Ionic App and I have applied the OR condition in ngStyle but it is not working with 2 conditions but with one it is working fine.
This is my condition:
<p
[ngStyle]="detailsp?.discount || detailsp?.discountp === '0' ?
{'text-decoration':'none'} : {'text-decoration':'line-through'}">
MRP: ₹{{detailsp.product_price || detailsp.disprice}}
</p>
It is not working but with only one condition it is working fine.
Showing This On Inspect:
<p
ng-reflect-ng-style="[object Object]"
style="text-decoration: none;">
MRP: ₹356
</p>
Any help is much appreciated.
Upvotes: 1
Views: 481
Reputation: 1196
I think angular working fine but ionic not, You can give brackets on them to ensure all working fine.
<p [ngStyle]="(detailsp?.discount || detailsp?.discountp === '0') ? {'text-decoration':'underline'} : {'text-decoration':'line-through'}">MRP: </p>
I think it might work.
Upvotes: 1