ngx-gallery:如何获取活动图像?

问题描述 投票:0回答:1

在文档中,仅向滑块的活动缩略图添加了样式。但是如何从活动图像中获取数据绑定?

https://github.com/lukasz-galka/ngx-gallery

angular typescript gallery image-gallery
1个回答
1
投票

您可以通过获取组件实例来获得活动/选定的索引,示例如下所示

import { NgxGalleryComponent } from "ngx-gallery";
...
@ViewChild(NgxGalleryComponent) ngxGalleryComponent;
...
ngOnInit() {
 console.log(this.ngxGalleryComponent.selectedIndex);
}

您可以使用selectedIndex获取活动项目/数据this.galleryImages[this.ngxGalleryComponent.selectedIndex]希望这会有所帮助:)

© www.soinside.com 2019 - 2024. All rights reserved.