【发布时间】:2020-05-12 11:00:09
【问题描述】:
在文档中,只有为滑块的活动缩略图添加样式。但是如何从活动图像中获取数据绑定?
【问题讨论】:
标签: angular typescript gallery image-gallery
在文档中,只有为滑块的活动缩略图添加样式。但是如何从活动图像中获取数据绑定?
【问题讨论】:
标签: angular typescript gallery image-gallery
你可以通过获取组件实例来获取活动/选定索引,示例如下所示
import { NgxGalleryComponent } from "ngx-gallery";
...
@ViewChild(NgxGalleryComponent) ngxGalleryComponent;
...
ngOnInit() {
console.log(this.ngxGalleryComponent.selectedIndex);
}
您可以使用 selectedIndex 获取活动项目/数据this.galleryImages[this.ngxGalleryComponent.selectedIndex]
希望这会有所帮助:)
【讨论】: