Apologies if this has been asked before, I've searched but couldn't find a solution so thought I'll ask to good ol' people here for help. Okay so the issue is, I have the following code,
<footer-price
*ngIf="showPriceWithSavings"
title="{{ getTitle() }}"
price="{{ getPrice(id, shouldShowPrice) }}"
info="or pay {{
getInfo(id, shouldShowPrice).price | currency : 'GBP' : 'symbol' : '1.2-2'
}}"
discount="You’ve saved <b>{{ getSavePrice(id, shouldShowPrice).savings | currency : 'GBP' : 'symbol' : '1.2-2' }}</b>"
[calculated]="true">
</footer-price>
Now as for Info attribute, I want to put a condition here to either show the text to pay ... or display NO text at all. Can I put a condition inside the info attribute or do I need to create a completely new component with *ngIf condition?!?
Hope my question makes sense and looking forward to some wonderful solutions
I answered a similar question here: https://stackoverflow.com/a/76951173/2005232. Using a directive. Below is the directive code copied from there. You can reuse it and change the attribute names accordingly.
A working example can be found here: https://stackblitz.com/edit/conditional-formcontrolname
And this is how it's called from a parent component: