ngx-gallery
ngx-gallery copied to clipboard
ngx gallery package onClick action is not working
galleryAction: NgxGalleryAction[];
ngOnInit(): void { this.galleryOptions = [ { "image": false, "preview": false, "thumbnailActions": this.galleryAction, "height": "515px", "width": "1200px", "thumbnailsRows": 3, "thumbnailsColumns": 7, "thumbnailsMargin": 10, "thumbnailsPercent": 100, }, { "breakpoint": 500, }, ]; this.handleClick = this.handleClick.bind(this); this.galleryAction = [{ icon: "TestData", onClick: this.handleClick }]; }; handleClick(): void { debugger; console.log("test"); }
Your code is not correct.
this.handleClick = this.handleClick.bind(this);
As far as I see assigning a function of an angular component with the same function again with a bind call would achieve nothing and has nothing to do with ngx-gallery.
@lukasz-galka What is the correct way to bind the click event