2.1.1 前端代码 (1) pinyougou-cart-web 的 cartService.js [AppleScript] 纯文本查看 复制代码 //获取地址列表
this.findAddressList=function(){
return $http.get('address/findListByLoginUser.do');
} (1) pinyougou-cart-web 的 cartController.js [AppleScript] 纯文本查看 复制代码 //获取地址列表
$scope.findAddressList=function(){ cartService.findAddressList().success(
function(response){
$scope.addressList=response;
}
(3)修改 getOrderInfo.html 引 入 js [AppleScript] 纯文本查看 复制代码 <script type="text/javascript" src="plugins/angularjs/angular.min.js"> </script>
<script type="text/javascript" src="js/base.js"> </script>
<script type="text/javascript" src="js/service/cartService.js"> </script>
<script type="text/javascript" src="js/controller/cartController.js"> </script> 指令 [AppleScript] 纯文本查看 复制代码 <body ng-app="pinyougou" ng-controller="cartController" ng-init="findAddressList()"> 循环列表 [AppleScript] 纯文本查看 复制代码 <div ng-repeat="address in addressList" >
<div class="con name">
<a href="javascript:;" >{{address.contact}}<span title="点击取消选择"> </a>
</div>
<div class="con address" >{{address.address}}<span>{{address.mobile}}</span>
<span class="base" ng-if="address.isDefault=='1'">默认地址</span>
<span class="edittext"><a data-toggle="modal" data-target=".edit"
data-keyboard="false" >编辑</a> <a href="javascript:;">删除</a></span>
</div>
<div class="clearfix"></div>
</div> 显示效果如下:
|