lukasz-galka / ngx-gallery

Angular image gallery plugin
https://lukasz-galka.github.io/ngx-gallery-demo/
MIT License
436 stars 172 forks source link

ngx gallery package onClick action is not working #300

Open pkmarathe opened 4 years ago

pkmarathe commented 4 years ago

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"); }

SnippetsUnlimited commented 4 years ago

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.

svipandi commented 3 years ago

@lukasz-galka What is the correct way to bind the click event