I have a scenario in my Component where we need to input an HTML attribute.
But if no value is provided for the input, I want to completely hide the attribute in the HTML. Is there a way to achieve this without displaying it as an empty string?
export class ProductComponent implements OnInit {
@Input dataQA: string;
HTML:
<div class="productTitle"
data-qa="dataQA"
>
Note: My goal is to retain the entire div structure while excluding specific attributes within it. There may be multiple attributes added in the future, so I am seeking an efficient solution to handle this.