//选择地址
$scope.selectAddress=function(address){
$scope.address=address;
}
//判断是否是当前选中的地址
$scope.isSelectedAddress=function(address){
if(address==$scope.address){ return true;
}else{
return false;
}
}
< div ng-repeat="address in addressList" >
<div class="con name {{isSelectedAddress(address)?'selected':''}}" ><a
href="javascript:;" ng-click="selectAddress(address)">{{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>
< div class="fc-receiverInfo"> 寄送至:{{address.address}} 收货人: {{address.contact}}
{{address.mobile}}</div>
//查询当前登录人的地址列表
$scope.findAddressList=function(){ addressService.findListByLoginUser().success(
function(response){
$scope.addressList=response;
//设置默认地址
for(var i=0;i< $scope.addressList.length;i++){
if($scope.addressList.isDefault=='1'){
$scope.address=$scope.addressList;
break;
}
}
}
);
}
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |