I have added the jquery and the zoom plugin file on my index.html. On my zoom component I have written some thing like the below code
import { Component,ElementRef,ngAfterViewInit } from '@angular/core';
@Component({
selector: 'product-gallery',
template: ` <div class="zoomWrapper">
<img id="elevatezoom_big" src="img/grande.png" data-zoom-image="img/grande.png" />
</div>
`,
})
export class ZoomComponent implements ngAfterViewInit{
rootNode : any;
container: any;
constructor(rootNode: ElementRef) {
this.rootNode = rootNode;
}
ngAfterViewInit() {
this.container = $(this.rootNode.nativeElement).find('#elevatezoom_big');
//console.log($(this.rootNode.nativeElement).find('#elevatezoom_big').attr('src'))
this.container.elevateZoom({
zoomType: "inner",
cursor: "crosshair",
zoomWindowFadeIn: 500,
zoomWindowFadeOut: 750
});
}
}
But it is not initializing the the plugin. If I use the same code in index.html and if the image is also present in index.html, it is working fine.