Yes, this was asked earlier, and I read all the answers, but nothing works. Therefore, I ask for extra eyes to see if you can find any feature in my code, which makes it not the way it should. (I tried this code and logic somewhere else, and it seems to be working fine). No console errors, by the way
I'm just trying to remove an element from the view when someone clicks x in the picture.
Here is the controller
app.controller('galleryController', ['$scope', '$http', function($scope, $http) { $http.get('data/galleries.json').success(function(data){ $scope.galleries = data; }).error(function(error) { console.log(error); }); $scope.removeGalleryItem=function(gallery){ var removedGallery = $scope.galleries.indexOf(gallery); $scope.galleries.splice(removedGallery, 1); }; }]);
and my mind
<div class="col-xs-12 col-md-3" ng-repeat="gallery in galleries" > <a class="gallery-item" ng-href="{{gallery.img}}" ng-class="{true:'active',false:''}[checked]" title="Nature Image 1" > <div class="image"> <img ng-src="{{gallery.img}}" alt="Nature Image 1"/> </div> <div class="meta"> <strong>{{gallery.title}}</strong> <span>{{gallery.desc}}</span> </div> </a> <ul class="gallery-item-controls"> <li><label class="check"><input type="checkbox" class="icheckbox" ng-model="checked" /></label></li> <li><span class="gallery-item-remove"><i class="fa fa-times" ng-click="removeGalleryItem(gallery)"></i></span></li> </ul> </div>
Angular 1.5.8
thanks
angularjs
Lotusms
source share