I am trying to figure out if in angular you can reuse a snippet of html across multiple angular components and locations.
What i am trying to solve is, on my drop down lists (whose information comes from outside my system), i wish to add a empty value and a placeholder to them if not selected, as follows :
<select class="custom-select" [(ngModel)]="modelValue">
<option value="">PlaceholderText</option>
<option value="null" hidden disabled>PlaceholderText</option>
<option value ="undefined" disabled hidden >PlaceholderText</option>
<option *ngFor="let option of option()" [value]="option.code">
{{optionn.desc}}
</option>
The code above works and achieves the expected result, what i am looking for is for a way to make those 3 first options reusable across my whole application in all the dropdown lists where i need it.
Tried with a super basic component with those first 3 options in the template but since it renders the component wrapper tag it does not work.
With templates i belive i would have to define it in each components base tempalte where i need it.
Is there any way i can define a ngTemplate,ngContainer or something else with that html snippet (the first 3 options) and reuse it across my application ?
Thank you