//三级分类选择后 读取模板 ID
$scope.$watch('entity.goods.category3Id', function(newValue, oldValue) {
itemCatService.findOne(newValue).success(
function(response){
$scope.entity.goods.typeTemplateId=response.typeId; //更新模板 ID
}
);
});
模板 ID:{{entity.goods.typeTemplateId}}
//模板 ID 选择后 更新品牌列表
$scope.$watch('entity.goods.typeTemplateId', function(newValue, oldValue) {
typeTemplateService.findOne(newValue).success(
function(response){
$scope.typeTemplate=response;//获取类型模板
$scope.typeTemplate.brandIds=
JSON.parse( $scope.typeTemplate.brandIds);//品牌列表
}
);
});
<script type="text/javascript" src="../js/service/typeTemplateService.js"> </script>
<select class="form-control" ng-model="entity.goods.brandId" ng-options="item.id as
item.text for item in typeTemplate.brandIds"></select>
//模板 ID 选择后 更新模板对象
$scope.$watch('entity.goods.typeTemplateId', function(newValue, oldValue) {
typeTemplateService.findOne(newValue).success(
function(response){
$scope.typeTemplate=response;//获取类型模板
$scope.typeTemplate.brandIds=
JSON.parse( $scope.typeTemplate.brandIds);//品牌列表
$scope.entity.goodsDesc.customAttributeItems=JSON.parse( $scope.typeTemplate.custom
AttributeItems);//扩展属性
}
);
});
<!--扩展属性-->
<div class="tab-pane" id="customAttribute">
<div class="row data-type">
<div ng-repeat="pojo in entity.goodsDesc.customAttributeItems">
<div class="col-md-2 title">{{pojo.text}}</div>
<div class="col-md-10 data">
<input class="form-control" ng-model="pojo.value" placeholder="{{pojo.text}}">
</div>
</div>
</div>
</div>
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |