ng-options/ng-model でデフォルト オプションを設定する際に問題が発生しました。
私の問題は、ドロップダウンに正しいオプションが入力されている間、デフォルトのオプションが空白になっていることです。これにより、ng-modelのやり方に何か問題があると信じるようになります。何か助けはありますか?
配列を反復処理するために ng-repeat を使用しているテーブルがあります。
$scope.dumpsters = [
{id:"1", sub_customer: 'a'},
{id:"2", sub_customer: 'b'},
{id:"3", sub_customer: 'c'}
]
簡単にするために、別の sub_customers の配列があります。
$scope.subCustomers = [{description:'a'}, {description:'b'}, {description:'c'}];
だから今私のテーブルでは、各行にはこれを含む列があります:
<select ng-model="d.sub_customer" ng-options="v.description for v in subCustomers" ng-change="updateCustomer(d.sub_customer, d.id)"></select>