m00s / angular-photoswipe

An angular directive for PhotoSwipe image gallery
MIT License
73 stars 42 forks source link

ReferenceError: PhotoSwipe is not defined #14

Closed g41n closed 8 years ago

g41n commented 8 years ago

Hi, I have installed angular-photoswipe via npm but when I try to use it I have this error:

angular_angular.js:13439 ReferenceError: PhotoSwipe is not defined
    at g (angular-photoswipe.min.js:7)
    at angular-photoswipe.min.js:7
    at Scope.$digest (angular_angular.js:16884)
    at Scope.$apply (angular_angular.js:17148)
    at HTMLAnchorElement.<anonymous> (angular_angular.js:24828)
    at HTMLAnchorElement.jQuery.event.dispatch (jquery.js:4723)
    at HTMLAnchorElement.elemData.handle (jquery.js:4391)

I use angular on meteor framework.

I have the same error if I try to include it directly without using npm.

Any hint would be appreciated, let me know if you need further details.

Best regards.

m00s commented 8 years ago

Hi @g41n, I'm pretty sure you forgot to include Photoswipe.js, see here

sfleischmann commented 6 years ago

Had the same error. Deleting checks and only loading the factory in photoswipe.js and photoswipe-ui-default.js worked for me:

(function (root, factory) { root.PhotoSwipe = factory(); })(this, function () {`

instead of

`(function (root, factory) {

if (typeof define === 'function' && define.amd) {
        define(factory);
} else if (typeof exports === 'object') {
    module.exports = factory();
} else {
    root.PhotoSwipe = factory();
}

})(this, function () {`