2017-05-14 83 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 –