A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区
传智教育官网黑马程序员官网
只需一步,快速开始
我是楠楠
黑马粉丝团
黑马币:5364
帖子:67337
精华:0
© 我是楠楠 黑马粉丝团 / 2020-5-21 11:08 / 1130 人查看 / 1 人回复 / 1 人收藏 转载请遵从CC协议 禁止商业使用本文
1.png (10.31 KB, 下载次数: 13)
下载附件
2020-5-21 11:02 上传
<script type="text/javascript" src="../js/base.js"></script> <script type="text/javascript" src="../js/service/goodsService.js"></script> <script type="text/javascript" src="../js/service/itemCatService.js"></script> <script type="text/javascript" src="../js/controller/baseController.js"></script> <script type="text/javascript" src="../js/controller/goodsController.js"></script>
//读取一级分类 $scope.selectItemCat1List=function(){ itemCatService.findByParentId(0).success( function(response){ $scope.itemCat1List=response; } ); }
<body class="hold-transition skin-red sidebar-mini" ng-app="pinyougou" ng-controller="goodsController" ng-init="selectItemCat1List()">
<select class="form-control" ng-model="entity.goods.category1Id" ng-options="item.id as item.name for item in itemCat1List"></select>
1.png (18.67 KB, 下载次数: 9)
2020-5-21 11:05 上传
//读取二级分类 $scope.$watch('entity.goods.category1Id', function(newValue, oldValue) { //根据选择的值,查询二级分类 itemCatService.findByParentId(newValue).success( function(response){ $scope.itemCat2List=response; } ); });
<select class="form-control select-sm" ng-model="entity.goods.category2Id" ng-options="item.id as item.name for item in itemCat2List"></select>
//读取三级分类 $scope.$watch('entity.goods.category2Id', function(newValue, oldValue) { //根据选择的值,查询二级分类 itemCatService.findByParentId(newValue).success( function(response){ $scope.itemCat3List=response; } ); });
<select class="form-control select-sm" ng-model="entity.goods.category3Id" ng-options="item.id as item.name for item in itemCat3List"></select>