s-yadav / iv-viewer

A zooming and panning plugin inspired by google photos for your web images.
MIT License
450 stars 163 forks source link

Angular 9 Update Issue - Already being initiated #72

Closed pateldips closed 4 years ago

pateldips commented 4 years ago

I updated to Angular 9 and code started breaking at below.

ERROR Error: An image viewer is already being initiated on the element. at ImageViewer._findContainerAndImageSrc (ImageViewer.js:239) at new ImageViewer

Do you have new updates for Angular 9?

Thank you

pateldips commented 4 years ago

If i add "enableIvy": false then it is working fine in Angular 8 w/o any issue. I load this component dynamically so i each it destroy and recreate the new component like below

ngAfterViewInit() { this.wrapper = document.getElementById('image-gallery'); this.viewer = new ImageViewer(this.wrapper.querySelector('.image-container'));

$(document).ready(function () {
  document.getElementById('imgdoc').addEventListener('click', function () {
    toggleFullscreen(document.getElementById('image-gallery'));
  });
});

}

and then call the load function when i have the data from API.