<button type="button" class="btn btn-default" title="新建" data-target="#uploadModal"
data-toggle="modal" ng-click="image_entity={}" ><i class="fa fa-file-o"></i> 新 建
</button>
$scope.entity={goods:{},goodsDesc:{itemImages:[]}};//定义页面实体结构
//添加图片列表
$scope.add_image_entity=function(){
$scope.entity.goodsDesc.itemImages.push($scope.image_entity);
}
<button class="btn btn-success" ng-click="add_image_entity()" data-dismiss="modal"
aria-hidden="true">保存</button>
<tr ng-repeat="pojo in entity.goodsDesc.itemImages">
<td>{{pojo.color}}</td>
<td><img alt="" src="{{pojo.url}}" width="100px" height="100px"></td>
<td><button type="button" class="btn btn-default" title="删除" ><i class="fa
fa-trash-o"></i> 删除</button></td>
</tr>
//列表中移除图片
$scope.remove_image_entity=function(index){
$scope.entity.goodsDesc.itemImages.splice(index,1);
}
<button
type="button"
class="btn btn-default"
title="
删 除
"
ng-click="remove_image_entity($index)"><i class="fa fa-trash-o"></i> 删除</button>
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |