Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

how can i use lightbox in demo 5 angular project


I read the documentation of the metronics theme for light box use. and followed the steps but it's not working fine in the angular project.


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hello,

May I know if you are referring to this docs page? The docs here is mostly only working for HTML version.
https://preview.keenthemes.com/html/metronic/docs/general/fslightbox

For angular, you may try this guide. To integrate fslightbox with Angular, you can follow these steps:

Install the fslightbox package using npm:


npm install fslightbox --save

Import fslightbox in your component where you want to use it:


import FsLightbox from "fslightbox";


Create a variable for the lightbox instance:


lightbox = null;


In the ngOnInit() method of your component, initialize the lightbox instance:


ngOnInit() {
this.lightbox = new FsLightbox();
}


Add a click event to the element that you want to trigger the lightbox:


<button (click)="openLightbox()">Open Lightbox</button>


In your component, create the openLightbox() method to open the lightbox when the button is clicked:


openLightbox() {
this.lightbox.open([...]); // add your image or video URLs inside the square brackets
}


To close the lightbox, call the close() method of the lightbox instance:


this.lightbox.close();



Thanks


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(