Empty first element in dropdown list

Use the directive ng-options and remove the value from the ‘Other’ option, like this:

<select id="sel" class="input-block-level" ng-model="list_category" ng-options="obj.id as obj.name for obj in list_categories.data">    
    <option value="">Other</option>
</select>

This ensures that if list_category is empty (no entry selected), the ‘Other’ option is selected (by default).

jsFiddle: http://jsfiddle.net/bmleite/gkJve/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)