Angular 角函数外的参考变量

Angular 角函数外的参考变量,angular,typescript,video,slider,Angular,Typescript,Video,Slider,我在.html中有这个代码 <mat-carousel timings="250ms ease-in" [autoplay]="false" interval="5000" color="accent" maxWidth="93%" proportion="80" slides="3" [loop]="true&quo

我在.html中有这个代码

<mat-carousel timings="250ms ease-in" [autoplay]="false" interval="5000" color="accent" maxWidth="93%"
            proportion="80" slides="3" [loop]="true" [hideArrows]="false" [hideIndicators]="false" [useKeyboard]="true"
            [useMouseWheel]="false" orientation="ltr" (change)="currentSlideIndex = $event">
            <mat-carousel-slide #matCarouselSlide *ngFor="let slide of video; let i = index"
              overlayColor="#00000040" [hideOverlay]="false">
              <video controls class="videostyle" #videoPlayer>
                <source *ngIf="slide.Video" src="{{slide?.Video}}" type="video/mp4">
                Browser not supported
              </video>
              <button (click)="toggleVideo(videoPlayer)">Play/Pause</button>
            </mat-carousel-slide>
            <br>
          </mat-carousel>

不支持浏览器
播放/暫停

在这段代码中,只有当我有一个来自这个
(change)=“currentSlideIndex=$event”的事件时,我才想调用这个
toggleVideo(videoPlayer)
,或者当我更改一个滑块时如何停止视频?这有可能吗