I'm creating a <select> dropdown using HTML5 and angular. I need the selected <option> to be determined dynamically via angular. If this were to be a static dropdown, it could be done as such:
<select>
<option value="1" selected>1</option>
<option value="2">2</option>
</select>
A typical dynamic value could be determined as such (assuming val1 and val2 are declared in the component):
<select>
<option [value]="val1">1</option>
<option [value]="val2">2</option>
</select>
But given that the select attribute has no ="" at the end, how could one assign it dynamically? In general, how could one assign such a value in angular? Especially since even if a value is provided to selected, it's simply ignored. So for example, <option selected="false"> would be rendered the same as <option selected>.