次のような を使用して入力された 2 つの選択フォームがありますng-options
。
<select ng-options="item.id as product.category for product in products" ng-model="order.category" ng-change='find_brands(order.category)' ></select>
<select ng-options="brand.id as brand.name for brand in brands" ng-model="order.brand" ></select>
<button ng-click='Get_Products(order)>ORDER</button>
$http
最初のドロップダウンが選択されると、次のように 2 番目のドロップダウンを設定するための呼び出しがトリガーされます。
$scope.find_brands = function(category){
$http
.get('Default.aspx/Find_Brands', {category: category})
.success(data){$scope.products = data.d};
};
"brands"
これにより、ドロップダウンに新しい値が正しく入力されます。しかし、ブランドを選びに行くとng-model
変わらない。テストすると、null 値が返されます。私はサイクルで$scope.$apply
作業することを検討しまし$digest
たが、それは私の問題ではないようです ("brands"
ドロップダウンは正常に更新されたデータを取得しますが、データを送信しません)。
何が起こっているのか、それを修正する方法を知っている人はいますか?