angular-bootstrap-lightbox icon indicating copy to clipboard operation
angular-bootstrap-lightbox copied to clipboard

Lightbox is undefined

Open cttech opened this issue 9 years ago • 1 comments

I am trying to user angular-bootstrap-lightbox via angular directive.

app.directive('productBuyers', ['Product', function(Product, Lightbox) {

    return {

        restrict : 'E',

        scope : {},

        template : '<div>' +
            '<p class="product-buyers-header bold" ng-show="photos.length">Others who have bought this product:</p>' +
            '<div class="product-buyers-container">' +
            '<div class="product-buyer placeholder square" ng-hide="photos.length"></div>' + 
            '<div class="product-buyer square" ng-click="openLightboxModal($index)" ng-repeat="photo in photos | limitTo:3" ng-style="{\'background-image\':\'url(\' + photo.image + \')\'}"></div>' + 
            '<div class="clear"></div>' +
            '</div>' +
            '</div>',

        link : function($scope, element, attrs) {

            $scope.photos = [];

            function getImages() {

                Product.customerPhotos(attrs.productId).success(function(response) {

                    $scope.photos = response.data;

                    Squares.init();

                }).error(function(response) {

                    console.log("There was a problem getting the product images");

                });

            }
            $scope.openLightboxModal = function (index) {
                Lightbox.openModal($scope.photos, index);
              };
            getImages();

        }

    }

}]);

it says " Lightbox is undefined". I am not sure how can I use it with directive. Is there any way to do it?

cttech avatar Jun 01 '16 06:06 cttech

app.directive('productBuyers', ['Product', function(Product, Lightbox) {

change this; app.directive('productBuyers', ['Product', 'Lightbox', function(Product, Lightbox) {

thats the problem.

cemarguvanli avatar Jul 07 '16 03:07 cemarguvanli