谁能建议我如何在angular2中使用旋转木马

问题描述 投票:0回答:2

我需要将angular2-carousel包含在表格中的图像中。任何人都可以帮我这样做吗?

这是我尝试过的HTML代码:

  <div class="row">
    <div class="col-md-12">
      <carousel>
        <img src="http://www.tripathihospital.com/images/hospital.jpg" style="margin:auto;">
          <div class="carousel-caption">
            <h3 style="background-color: transparent;color: white;">Slide {{index + 1}}</h3>
          </div>
       </carousel>
    </div>
  </div>
 </td>

控制台输出:

Uncaught Error: Template parse errors:
'carousel' is not a known element:
1. If 'carousel' is an Angular component, then verify that it is part of this module. 
html angular carousel
2个回答
0
投票

Website说旋转木马的选择器不是<carousel>,而是<carousel-component>

更新选择器。


0
投票

它工作正常检查我创建的这个Stackblitz示例。

我认为你不是在安装对等依赖项。

npm install @types/hammerjs
npm install hammerjs
© www.soinside.com 2019 - 2024. All rights reserved.