我选择父项时有2个方框,第二个选择所选父项的子项。
如何在第二次选择后运行下面的函数?
角度函数
$scope.myFunc = function() {
var jsonItem = JSON.parse($scope.formData.formatType.id);
sessionStorage.setItem('format', jsonItem);
}
HTML
<select ng-model="formData.ProductType.name" ng-change="productTypeChange()" ng-options="product.name as product.name for product in productsandformats">
<option value="">- Please Choose -</option>
</select>
<select ng-model="formData.formatType" ng-options="format.Fname for format in formats.format" ng-if="formData.ProductType.name">
<option value="">- Please Choose -</option>
</select>
答案 0 :(得分:2)
使用ng-change
<select ng-model="formData.formatType"
ng-options="format.Fname for format in formats.format"
ng-if="formData.ProductType.name" ng-change="myFunc()">
<option value="">- Please Choose -</option>
</select>`