【发布时间】:2021-08-04 14:27:49
【问题描述】:
这是我第一次在 Angular 中使用 Bootstrap 的轮播元素,我遇到了一个奇怪的问题,即每次转换之前都会出现白色幻灯片(参见下面的 gif)。我按照 ng-bootstrap Github 页面上的所有基本步骤进行设置,但找不到问题。以下是相关文件:
当前问题的 Gif: https://ibb.co/p38LP4X
home.html
...
<ngb-carousel *ngIf="images" [interval]="5000" [pauseOnHover]="pauseOnHover" [pauseOnFocus]="pauseOnFocus">
<ng-template ngbSlide *ngFor="let img of images; index as i">
<div class="carousel-caption">
<h1>AS SOLID AS THEY COME</h1>
</div>
<div class="img-wrapper">
<img [src]="img" alt="My image {{i + 1}} description">
</div>
</ng-template>
</ngb-carousel>
...
angular.json
...
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
...
我还在 index.html 中包含另一个引导程序版本,因为仅使用 angular.json 中的引导程序版本根本无法使轮播功能发挥作用。
index.html
<head>
...
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" />
...
</head>
【问题讨论】:
标签: angular typescript