Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including ng-image-slider with all npm packages installed. Try it out:

require("@angular/common/package.json"); // @angular/common is a peer dependency. require("@angular/core/package.json"); // @angular/core is a peer dependency. var ngImageSlider = require("ng-image-slider")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

ng-image-slider v2.4.1

Angular Image slider with lightbox. An Angular responsive image slider with lightbox popup. Also support youtube url, image base64 string and mp4 video urls and base64 string.

Angular Image Slider with Lightbox

An Angular responsive image slider with lightbox popup. Also support youtube and mp4 video urls.


  • Responsive (support images width and height in both % and px)
  • captures swipes from phones and tablets
  • Compatible with Angular Universal
  • Image lightbox popup
  • captures keyboard next/previous arrow key event for lightbox image move
  • Support Images (jpeg, jpg, gif, png and Base64-String), Youtube url and MP4 video (url and Base64-String)
  • Handling runtime image arraylist changes



npm install ng-image-slider --save

Setup :

Import module in your app.module.ts:

import { NgImageSliderModule } from 'ng-image-slider';

    declarations: [
    imports: [
    providers: [],
    bootstrap: [AppComponent]

export class AppModule {

Add component in your template file.

<ng-image-slider [images]="imageObject" #nav></ng-image-slider>

ImageObject format

imageObject: Array<object> = [{
        image: 'assets/img/slider/1.jpg',
        thumbImage: 'assets/img/slider/1_min.jpeg',
        alt: 'alt of image',
        title: 'title of image'
    }, {
        image: '.../iOe/xHHf4nf8AE75h3j1x64ZmZ//Z==', // Support base64 image
        thumbImage: '.../iOe/xHHf4nf8AE75h3j1x64ZmZ//Z==', // Support base64 image
        title: 'Image title', //Optional: You can use this key if want to show image with title
        alt: 'Image alt' //Optional: You can use this key if want to show image with alt

Image, Youtube and MP4 url's object format

imageObject: Array<object> = [{
       video: '' // Youtube url
       video: 'assets/video/movie.mp4', // MP4 Video url
       video: 'assets/video/movie2.mp4',
       posterImage: 'assets/img/slider/2_min.jpeg', //Optional: You can use this key if you want to show video poster image in slider
       title: 'Image title'
       image: 'assets/img/slider/1.jpg',
       thumbImage: 'assets/img/slider/1_min.jpeg',
       alt: 'Image alt'

API Reference (optional) :

NameTypeData TypeDescriptionDefault
infinite@InputbooleanInfinite sliding images if value is true.false
imagePopup@InputbooleanEnable image lightBox popup option on slider image click.true
animationSpeed@InputnumberBy this user can set slider animation speed. Minimum value is 0.1 second and Maximum value is 5 second.1
slideImage@InputnumberSet how many images will move on left/right arrow click.1
imageSize@InputobjectSet slider images width, height and space. space is use for set space between slider images. Pass object like {width: '400px', height: '300px', space: 4} or you can pass value in percentage {width: '20%', height: '20%'} OR set only space {space: 4}{width: 205, height: 200, space: 3}
manageImageRatio@InputbooleanShow images with aspect ratio if value is true and set imageSize width and height on parent divfalse
autoSlide@InputnumberAuto slide images according provided time. Option will work only if infinite option is true. Minimum value is 1 second and Maximum value is 5 second.0
showArrow@InputbooleanHide/Show slider arrow buttonstrue
arrowKeyMove@InputbooleanDisable slider and popup image left/right move on arrow key press event, if value is falsetrue
videoAutoPlay@InputbooleanAuto play popup videofalse
direction@InputstringSet text direction. You can pass rtl / ltr / autoltr
imageClick@Outputn/aExecutes when click event on slider image. Return image index.n/a
arrowClick@Outputn/aExecutes when click on slider left/right arrow.n/a
lightboxArrowClick@Outputn/aExecutes when click on lightbox next/previous arrow.n/a

Add custom navigation button

import { NgImageSliderComponent } from 'ng-image-slider';

    selector: 'sample',
        <ng-image-slider [images]="imageObject" #nav>
        <button (click)="prevImageClick()">Prev</button>
        <button (click)="nextImageClick()">Next</button>
class Sample {
    @ViewChild('nav') slider: NgImageSliderComponent;
    imageObject = [{...}]
    prevImageClick() {
    nextImageClick() {;


As Angular itself, this module is released under the permissive MIT license.

Your contributions and suggestions are always welcome :)

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free