我已經顯示使用ng-repeat
圖像如下:隱藏特定圖像+ angular.js
我的html的代碼:
<div class="form-group col-md-4" ng-show="humbnailshow " ng-repeat="x in thumbnail ">
<label>Thumbamil Images </label>
<!--<input type="file " ngf-select ng-model="picFile1 " name="file " accept="image/* " ngf-max-size="2MB " ngf-model-invalid="errorFile " required/>-->
<!-- <input ng-hide="recipeForm.file.$valid " type="file " ngf-select ng-model="thumbnailImage " ng-show="newthumbnailImageStatus " name="file " accept="image/* " ngf-max-size="2MB "
ngf-model-invalid="errorFile "> -->
<i ng-show="recipeForm.file.$error.maxSize ">File too large {{errorFile.size/1000000|number:1}}MB: max 2M</i>
<img ng-show="recipeForm.file.$valid " class="thumb " ngf-thumbnail="x ">
<i class="glyphicon glyphicon-remove " ng-click="thumbnailViewchange(x) " ng-show="x ">Remove</i>
</div>
我的JS文件的控制器:
$scope.thumbnailViewchange = function (imageUrl) {
$scope.newthumbnailImageStatus = true;
var last = imageUrl.substring(imageUrl.lastIndexOf("/") + 1, imageUrl.length);
var index = cust.thumbnail.indexOf(last);
cust.thumbnail.splice(index, 1);
}
現在圖像顯示如下:
Image1 Image2 Imgae3
現在,當我點擊刪除圖標時,應該隱藏該特定圖像。