Java之品优购课程讲义_day06(2)

1.1.1 二级分类下拉选择框
在 goodsController 增加代码:

//读取二级分类

$scope.$watch('entity.goods.category1Id',  function(newValue,  oldValue)  {

//根据选择的值,查询二级分类itemCatService.findByParentId(newValue).success(

function(response){

$scope.itemCat2List=response;

}

);

});

$watch 方法用于监控某个变量的值,当被监控的值发生变化,就自动执行相应的函数。修改 goods_edit.html 中二级分类下拉框

1.1.1 [img=570,66]三级分类下拉选择框
在 goodsController 增加代码:

//读取三级分类

$scope.$watch('entity.goods.category2Id',  function(newValue,  oldValue)  {
//根据选择的值,查询二级分类itemCatService.findByParentId(newValue).success(

function(response){

$scope.itemCat3List=response;

}

);

});
[img=40,24]修改 goods_edit.html 中三级分类下拉框
<
select
class="form-controlselect-sm"ng-model="entity.goods.category3Id"
ng-options="item.idasitem.nameforiteminitemCat3List"></select>

1.1.1 读取模板 ID
在 goodsController 增加代码:

//三级分类选择后 读取模板 ID

$scope.$watch('entity.goods.category3Id',  function(newValue,  oldValue)  { itemCatService.findOne(newValue).success(
function(response){

$scope.entity.goods.typeTemplateId=response.typeId; //更新模板 ID

}

);

});

在 goods_edit.html 显示模板 ID

模板 ID:{{entity.goods.typeTemplateId}}

转载于:https://blog.51cto.com/13517854/2161946

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值