I'm trying to get rid of this empty <option> in my <select>. I've read a number of other questions about this, but none of them seem to be helping me. Can anybody help me get rid of the empty <option> in this fiddle? Thanks.
js
function testCtrl($scope) {
$scope.data = {};
$scope.data.club = {'1':{name:'club name!'}};
$scope.data.admin = [{related_id:'1',related_table:'club'}]
//$scope.admin_idx = 0;
}
html
<div ng-controller="testCtrl">
<select ng-model="admin_idx">
<option ng-repeat="admin in data.admin" value="{{$index}}">
{{data[admin.related_table][admin.related_id].name}}</option>
</select>
http://docs.angularjs.org/api/ng.directive:select
<select ng-model="admin_idx"
ng-options="$index as data[admin.related_table][admin.related_id].name for admin in data.admin">
</select>
hope this helps