There is this simple component. Some usages require an ID on the input field, others don't. I cannot find out how to leave out the id attribute entirely when the value is falsy. How can this be done?
This is what I have so now:
<div class="form-group row">
<label [for]="id ? id : ''" class="col-5 col-form-label">{{ label | translate }}:</label>
<div class="col-7">
<input type="text" readonly class="form-control-sm form-control-plaintext" [id]="id ? id : ''"
[value]="value">
</div>
</div>
But this results in rendering it as
<input type="text" readonly="" class="form-control-sm form-control-plaintext" id="">
For null and undefined the text literally is null and undefined, so that is not working either.
I wish to void having to use *ngIf for this.