前端代码
(1) pinyougou-cart-web 的 cartService.js
//获取地址列表
this.findAddressList=function(){
return $http.get('address/findListByLoginUser.do');
}
(1) pinyougou-cart-web 的 cartController.js
//获取地址列表
$scope.findAddressList=function(){ cartService.findAddressList().success(
function(response){
$scope.addressList=response;
}
(3)修改 getOrderInfo.html
引 入 js
<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>
指令
<body ng-app="pinyougou" ng-controller="cartController" ng-init="findAddressList()">
循环列表
<div ng-repeat="address in addressList" >
<div class="con name">
<a rel="nofollow" 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 rel="nofollow" href="javascript:;">删除</a></span>
</div>
<div class="clearfix"></div>
</div>
显示效果如下: