我有一個選擇框,其中的選項從我的後端填充。在selectbox中設置選定的值angularjs
<tr>
<td class="col-lg-4">Superkund</td>
<td><select class="form-control input-sm2" ng-model="selectedSupercustomer" ng-options="item as item.namn for item in superkundOptions" ng-change="onChangeSuperCustomer(selectedSupercustomer)"></select></td>
</tr>
$http.get($rootScope.appUrl + '/nao/abb/getSuperkundData/' + $rootScope.abbForm).success(function(data) {
$scope.superkundOptions = data;
});
我遇到的問題是第一行是空行,我想用選定的值替換空。我試過這個:
$scope.selectedSupercustomer = "fish"
但這並不奏效。任何人都可以幫助我?
Na bro,那也行不通:/ – user500468
@ user500468檢查更新 - > [JSFiddle](https://jsfiddle.net/ pqxo6rqx /) – valverde93
這對我不起作用。請檢查我的代碼:http://pastebin.com/Fd8xU19v – user500468