如何访问Angular中的情感事件?

如何访问Angular中的情感事件?,angular,svg,svg-animate,Angular,Svg,Svg Animate,animateMotion元素触发三个事件:onbegin、onrepeat和onend。在纯Javascript中,我可以像这样绑定eventlistener: <circle r="15" fill="red"> <animateMotion dur="10s" begin="indefinite" repeatCount="indefinite" calcMode="linear"

animateMotion
元素触发三个事件:
onbegin
onrepeat
onend
。在纯Javascript中,我可以像这样绑定eventlistener:

<circle r="15" fill="red">
    <animateMotion
        dur="10s" 
        begin="indefinite" 
        repeatCount="indefinite" 
        calcMode="linear"
        repeatCount="indefinite" 
        path="...."
    />
</circle>


var anim = document.getElementsByTagName("animateMotion");

anim.onrepeat = function() {
    alert("repeat")
}
anim.onbegin = function() {
    alert("start")
}
anim.onend = function() {
    alert("end")
}

var anim=document.getElementsByTagName(“animateMotion”);
anim.onrepeat=函数(){
警报(“重复”)
}
anim.onbegin=函数(){
警报(“启动”)
}
anim.onend=函数(){
警报(“结束”)
}
但是我怎样才能在第九章中看到这些事件呢?有没有办法进入这些活动

Thx提前,
Lars

尝试下面更新的方法,因为我最初的假设确实不准确,因为我对这些具体事件不太熟悉

更新:我最初的假设是,下面的方法会起作用-被证明是错误的:

<svg:circle r="15" fill="red">
    <svg:animateMotion (repeat)="repeatMethodInsideTs()"
        dur="10s" 
        begin="indefinite" 
        repeatCount="indefinite" 
        calcMode="linear"
        repeatCount="indefinite" 
        path="...."
    />
</svg:circle>

这里是stackblitz:

这不是解决方案。Angular不处理这些事件。但是我在
ngAfterViewInit(){this.innerTrack=this.element.nativeElement.querySelector('#innerTrack');this.innerTrack.onbegin=()=>{…}
中找到了一个很好的解决方案。所以我用解决方案更新了答案。您可以直接使用(repeat)在角度上不起作用,但使用(repeatEvent)却起作用。请查收。您的解决方案也可以工作,但确实引入了DOM级别的API,这是不太理想的。太棒了。谢谢。非常感谢你。也许,您是否也有此问题的解决方案?好的,请检查!:)
<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg">
  <svg:path fill="none" stroke="lightgrey"
    d="M20,50 C20,-50 180,150 180,50 C180-50 20,150 20,50 z" />

  <svg:circle r="5" fill="red">
    <svg:animateMotion (beginEvent)="begin($event)" (repeatEvent)="repeat($event)" dur="3s" repeatCount="indefinite"
      path="M20,50 C20,-50 180,150 180,50 C180-50 20,150 20,50 z" />
  </svg:circle>
</svg>
import { Component } from '@angular/core';

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
})
export class AppComponent  {
  name = 'Angular';

  repeat(event) {
    console.log("repeat event called", event)
  }

  begin(event) {
    console.log("repeat event called", event)
  }
}