Arrays ngbCarroussel:数组中的空格';只有3个元素(图片)时的第4位

Arrays ngbCarroussel:数组中的空格';只有3个元素(图片)时的第4位,arrays,angular,carousel,ng-bootstrap,Arrays,Angular,Carousel,Ng Bootstrap,我正在从本地数据库获取图像并将其上传到ngbCarroussel。问题是,我只有3个图片对象,但旋转木马假设有4个,因此,我在同一个超时帧中得到一个空白空间,它正在破坏旋转木马。我不明白为什么会发生这种情况,因为我肯定只有3张照片。有关守则 接收对象的基本组件: ngOnInit(): void { this.nasaService.getImages(); this.nasaService.getPictureUpdateListener() .subscribe(da

我正在从本地数据库获取图像并将其上传到ngbCarroussel。问题是,我只有3个图片对象,但旋转木马假设有4个,因此,我在同一个超时帧中得到一个空白空间,它正在破坏旋转木马。我不明白为什么会发生这种情况,因为我肯定只有3张照片。有关守则

接收对象的基本组件:

ngOnInit(): void {
    this.nasaService.getImages();
    this.nasaService.getPictureUpdateListener()
    .subscribe(data=>{
     this.pictureObject=data;
     console.log(this.pictureObject); --->3 images
    });

  }
HTML,通过输入传递图片

 <div class="row"  >
    <app-carroussel [pictureObject]="pictureObject"></app-carroussel>
  </div>
Carroussel HTML:

<ngb-carousel *ngIf="pictureObject">
  <ng-template ngbSlide *ngFor="let p of pictureObject; let i =index">
    <div class="img-wrapper">
      <img class="img-fluid" src="{{p.hdurl}}" alt="{{p.title}}">
    </div>
    <div class="carousel-caption">
      <h3>{{p.title}}</h3>
      <p>{{p.explanation}}</p>
    </div>
  </ng-template>
  <ng-template ngbSlide>

{{p.title}}
{{p.解释}


我可以在标题中看到carroussel需要第四张图像,但在重新启动之前,结尾没有空白…有人能帮我吗?

在carroussel HTML的结尾看起来像是一张迷路的
。这可能是你的问题吗?
<ngb-carousel *ngIf="pictureObject">
  <ng-template ngbSlide *ngFor="let p of pictureObject; let i =index">
    <div class="img-wrapper">
      <img class="img-fluid" src="{{p.hdurl}}" alt="{{p.title}}">
    </div>
    <div class="carousel-caption">
      <h3>{{p.title}}</h3>
      <p>{{p.explanation}}</p>
    </div>
  </ng-template>
  <ng-template ngbSlide>