Q:

Validating select element based on pattern with AngularJS

I'm developing an Angular app and I have a form set up which  I need to run validation on.  One of the form elements is a <select>, like this:
<select name="noOfPeople" ng-model="noOfPeople">
    <option>No of people*</option>
    <option ng-repeat="amt in [] | range:12">{{ amt +1 }}</option>
</select>

Because the design doesn't allow for labels on form elements, the label is essentially the first option in the select element.  I want this control to be invalid unless it matches the following pattern: /^[0-9]$/.
I have tried using ng-pattern on the <select> however that doesn't seem to have any effect, Angular always thinks the control is valid. 
The only other way I can think of doing it is writing a function in my controller to check if this control is valid and block the form from submitting if it's not.  But I don't want to introduce a random validation function into my nice clean controller. 
What's the best way to deal with this? 

A:

You can use the ng-options attribute here, rather than ng-repeat, and attribute a blank value to any options you wish to ignore.  For example:
<select name="noOfPeople" ng-model="noOfPeople" ng-options="value for value in [] | range:12">
    <option value="">No of people*</option>
    <option value="">This won't count either!</option>
</select>
<p>Selected Value: {{noOfPeople}}<p>

If you explicitly require the regex checking to occur, you could write a filter and add it to the ng-options.