在文档中,仅向滑块的活动缩略图添加了样式。但是如何从活动图像中获取数据绑定?
您可以通过获取组件实例来获得活动/选定的索引,示例如下所示
import { NgxGalleryComponent } from "ngx-gallery";
...
@ViewChild(NgxGalleryComponent) ngxGalleryComponent;
...
ngOnInit() {
console.log(this.ngxGalleryComponent.selectedIndex);
}
您可以使用selectedIndex获取活动项目/数据this.galleryImages[this.ngxGalleryComponent.selectedIndex]
希望这会有所帮助:)