Skip to content

Lightbox is undefined #63

Open
Open
@cttech

Description

@cttech

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions