I have a select box tied to an ngModel:
tempHours = [
{},
{},
{},
...
]
<select name="repeat" [(ngModel)]="tempHours[index].repeat">
<option value="Every" selected>Every Day</option>
<option value="Every Other">Every Other Day</option>
</select>
When this code is reached for the first time, tempHours[index] is an empty object. So the ngModel is inserting an option tag with undefined value and blank text and not respecting the selected attribute.
In reading up on the angular bug trackers, they defend this as a feature not a bug, but this is clearly not desired behavior. I could go through and predefine all the tempHours objects to have repeat be "Every", but there has got to be a more elegant way for ngModel to fall back to the html attribute if it is undefined.
Any suggestions? Or am I just going to have to predefine the tempHours objects for the repeat?