如何在Angular2中使用Coverflow或滑动滑块 [英] How to use coverflow or slick slider in Angular2
问题描述
我需要在Angular2应用程序中使用平滑轮播或Coverflow之类的功能. npm是否提供了可以在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?
其中一个Stack Overflow问题讨论了此主题,但并未突出使用它的方式.
One of the Stack Overflow questions talks about this topic but it does not highlight the way to use it.
此处链接:带有Angular 2的光滑轮播.
推荐答案
实施光滑轮播非常简单,您需要执行以下操作:
npm install slick-carousel --save --global
然后安装类型
$ npm install @types/slick-carousel
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();
}
}
这篇关于如何在Angular2中使用Coverflow或滑动滑块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!