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.
http://jsfiddle.net/4CYkd/
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
http://jsfiddle.net/4CYkd/1/
<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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With