Search code examples
angulartypescriptcarouselslick.jscoverflow

How to use coverflow or slick slider in Angular2


I need to use slick carousel or coverflow like functionality in Angular2 application. Is there a plugin or module provided by npm for the same that can be used in Angular2?

One of the Stack Overflow questions talks about this topic but it does not highlight the way to use it.

Link here: Slick Carousel with Angular 2.


Solution

  • Implementation of slick carousel is really easy and you need to do the following:
    npm install slick-carousel --save --global

    Then install types
    $ npm install @types/slick-carousel

    And last you need to call it into component like this

    import {Component, OnInit} from '@angular/core';
    import * as jQuery from 'jquery';
    import 'slick-carousel';
    
    @Component({
      selector: 'your-page',
      templateUrl: './your-page.component.html',
    })
    export class YourPageComponent implements OnInit{
    
      ngOnInit() {
        jQuery(".your-slider").slick();
      }
    
    }