2017-05-14 79 views
0

我试图得到angular4-carousel与我的角4的应用程序 工作不会给出错误,但它不会显示angular4传送带不显示

我把这个在我的app.component.html

<carousel [sources]="imageSources" [config]="config"></carousel> 

我把这个在我的app.component.ts

public imageSources: string[] = [ 
'http://lorempixel.com/400/200/', 
'http://lorempixel.com/400/200/sports/' 
]; 

public config: ICarouselConfig = { 
verifyBeforeLoad: true, 
log: true, 
animation: true, 
animationType: AnimationConfig.SLIDE, 
autoplay: true, 
autoplayDelay: 2000, 
stopAutoplayMinWidth: 768 
}; 

该页面加载,但没有旋转木马。有一些特定的CSS,我需要包括?

+0

请有关'angular4-carousel'多个指定的(有快速链接到让别人看的包)。也让一个可运行的重击者重现你的问题会更好地让别人快速知道你正面临着什么。 – Pengyy

回答

0

请检查安装步骤为你的模块导入部分

imports: [CarouselModule] 

在组件文件下面

给出在app.module.ts

import { CarouselModule } from 'angular4-carousel'; 

加旋转木马;

import { ICarouselConfig, AnimationConfig } from 'angular4-carousel'; 

并且你的问题的配置是可以的。

另外请检查一下,如果您使用CLI,请将css文件导入到css部分的angular-cli.json文件中;如果没有,你有下面的代码添加到index.html或进口下面的CSS路径常见的style.css文件

<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> 
+0

如果你使用system.js你能指导我我总是有错误。从http:// localhost:5555/node_modules/angular4-carousel/index将http:// localhost:5555/node_modules/angular4-carousel/src/app/services.js加载为“./src/app/services”时出错。 JS –