themyth92 / ngx-lightbox

Lightbox2 use with angular >= 5
MIT License
115 stars 66 forks source link

Lightbox not opening image modal #32

Closed paoespinoza closed 4 years ago

paoespinoza commented 5 years ago

My lightbox is not working properly when I click on the image to open the modal, I'm getting several errors. I'm using angular 7 and "ngx-lightbox": "1.2.0"

I included the css in my component: @component({ selector: 'application-damage', templateUrl: './productDamage.component.html', styleUrls: [ '../../../../node_modules/ngx-lightbox/lightbox.css'], moduleId: module.id.toString() })

My array of images look like that: 0: caption: "Image 1" src: "https://media/Images/822ee069-ab25-4e04-b8e9-a207f779028d.jpeg" thumb: "https://media/Images/822ee069-ab25-4e04-b8e9-a207f779028d.jpeg" 1: caption: "Image 1" src: "https://media/Images/822ee069-ab25-4e04-b8e9-a207f779028d.jpeg" thumb: "https://media/Images/822ee069-ab25-4e04-b8e9-a207f779028d.jpeg"

And Im using the code exactly how it shows is in the example.

The error: LightboxComponent.html:4 ERROR TypeError: Cannot read property 'src' of undefined at Object.eval [as updateRenderer] (LightboxComponent.html:4) at Object.debugUpdateRenderer [as updateRenderer] (core.js:20375) at checkAndUpdateView (core.js:19750) at callViewAction (core.js:19986) at execComponentViewsAction (core.js:19928) at checkAndUpdateView (core.js:19751) at callWithDebugContext (core.js:20639) at Object.debugCheckAndUpdateView [as checkAndUpdateView] (core.js:20317) at ViewRef_.push../nodemodules/@angular/core/fesm5/core.js.ViewRef.detectChanges (core.js:18126) at core.js:14788

Is there any problem if the thumb and src in the array are the same??

themyth92 commented 5 years ago

Hi there, if u can have a repo for your problem so that i can take a look, that would be awesome. Right now I have no way to know as it works fine on my local machine

themyth92 commented 5 years ago

Also could u try to use lightbox 2.0.0 instead as someone has luck with that version for angular7

moshebengan commented 4 years ago

I'm having the same issue should the photos need to be declare on constructor? I'm creating array of objects on ngOnInit() because i'm getting the data from http get request The gallery displayed good - but when tapping on thumbnail - page scroller expands - that's it.