ngx-owl-carousel无法在角度6中工作 [英] ngx-owl-carousel is not working in angular 6

查看:180
本文介绍了ngx-owl-carousel无法在角度6中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的angular 6应用程序,并添加了一个simple ngx-owl-carousel,我按照说明进行了所有步骤,这里是链接:

I have a simple angular 6 app and I have a added a simple ngx-owl-carousel , I have followed all steps as per instruction here is the link : https://www.npmjs.com/package/ngx-owl-carousel.

这是我的html:

<owl-carousel
[options]="{items: 4, dots: false, navigation: false}"
[items]="images"
[carouselClasses]="['owl-theme', 'row', 'sliding']">
<div class="item" *ngFor="let image of images;let i = index">
    <div class="thumbnail-image"></div>
  </div>
</owl-carousel>

这是component.ts图片数组

here is component.ts array of immages

export class WhatwedoComponent {
  images = [
    '/assets/images/ico_1_dark.png',
    '/assets/images/ico_2_dark.png',
    '/assets/images/ico_3_dark.png',
    '/assets/images/ico_4_dark.png',
  ];

}

不幸的是,轮播在我的应用程序中根本没有显示;在控制台浏览器中没有错误.

Unfortunately the carousel is not displayed at all in my app; in console browser no errors.

我的代码有什么问题吗?任何帮助都将被取消.

what is wrong with my codes ?, any help will be apreciated .

推荐答案

您缺少img元素.

<img [src]="image"/>

进行以下调整.

<owl-carousel
[options]="{items: 4, dots: false, navigation: false}"
[items]="images"
[carouselClasses]="['owl-theme', 'row', 'sliding']">
<div class="item" *ngFor="let image of images;let i = index">
    <div class="thumbnail-image">
       <img [src]="image"/>
     </div>
  </div>
</owl-carousel>

这篇关于ngx-owl-carousel无法在角度6中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆