devmark / angular-slick-carousel

Angular directive for slick-carousel
http://devmark.github.io/angular-slick-carousel/
MIT License
353 stars 125 forks source link

Calling slickRemove from Controller #74

Open dev408 opened 8 years ago

dev408 commented 8 years ago

I would like to be able to call slickRemove from my controller as I need to do a call to a REST service in addition to removing it from the view. I can't seem to get the syntax to reference that method from the controller.

Also, I was trying to get the current index to use in the view to delete the current slide but when I call slickRemove referencing the variable $scope.slickCurrentIndex when it gets to the function to remove it the index is undefined. Though I can see the correct index in the view.

nimeso commented 5 years ago

I have the same issue...please help.

<slick settings="slickConfig" dots=true infinite="true" slides-to-show="1" slides-to-scroll="1" init-onload="true" data="point.Images">
              <div class="slick-item" ng-repeat="image in point.Images">
                <img class="d-block" ng-src="{{image.ImageLinkBig}}" />
                <div class="delete-image" ng-click="deletePointImage(image.ID)"><md-icon ng-bind="'delete'"></md-icon></div>
              </div>
            </slick>
/* Image Management */
        $scope.slickConfig = {
            method: {}
        }

        $scope.deletePointImage = function(id) {
            $scope.slickConfig.slickRemove(3)
        }

returns a console error: VM3348 angular.js:28723 TypeError: $scope.slickConfig.slickRemove is not a function