我有一个问题,当旋转木马的动态项目使用拼接函数删除项目时。

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

当一个使用拼接功能删除项目(图像),他们删除所有的图像。

 when i delete the item  I want the carousel show the others images not disappear.
<div id="carouselExampleControls " class="carousel slide "
 data-ride="carousel">
  <div class="carousel-inner" >

    <div class="carousel-item" *ngFor="let img of urls; let i = index;
    let isFirst = first" [ngClass]="{active:isFirst}"
    >

      <img  [src]="img" >

      <div class="carousel-caption d-non "
       >

<button type="button" (click)="removeSelectedFile(index)" 
class="btn btn-xs btn-default" >
<img src="../assets/images/delete_delete_exit_1577.png"
           style="width: 20px;" /></button>


      </div>
    </div>

  </div>
  <a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>

`removeSelectedFile(index)
   { 
    this.urls.splice(index, 1);
     } `

当我删除该项目时,我希望旋转木马显示其他图像而不是消失.感谢您的帮助。

c# angular carousel
1个回答
0
投票
 this.urls = this.urls.splice(index, 1);
© www.soinside.com 2019 - 2024. All rights reserved.