Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lightbox is undefined #63

Open
cttech opened this issue Jun 1, 2016 · 1 comment
Open

Lightbox is undefined #63

cttech opened this issue Jun 1, 2016 · 1 comment

Comments

@cttech
Copy link

cttech commented Jun 1, 2016

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?

@cemarguvanli
Copy link

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

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

thats the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants