Angular 10 Lightbox Working Tutorial

PHOTO EMBED

Thu Nov 25 2021 01:31:38 GMT+0000 (UTC)

Saved by @sofiabedoy_96

import { Lightbox } from 'ngx-lightbox';
 
export class AppComponent {
  _albums = [];
  constructor(private _lightbox: Lightbox) {
    for (let i = 1; i <= 4; i++) {
      const src = 'https://themyth92.com/project/ngx-lightbox/demo/img/image' + i + '.jpg';
      const caption = 'Image ' + i + ' caption here';
      const thumb = 'https://themyth92.com/project/ngx-lightbox/demo/img/image' + i + '-thumb.jpg';
      const album = {
         src: src,
         caption: caption,
         thumb: thumb
      };
 
      this._albums.push(album);
    }
  }
 
  open(index: number): void {
    // open lightbox
    this._lightbox.open(this._albums, index);
  }
 
  close(): void {
    // close lightbox programmatically
    this._lightbox.close();
  }
}
content_copyCOPY

https://therichpost.com/angular-10-lightbox-working-tutorial/