Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript 将加载事件侦听器添加到对象元素时加载循环_Typescript_Angular8 - Fatal编程技术网

Typescript 将加载事件侦听器添加到对象元素时加载循环

Typescript 将加载事件侦听器添加到对象元素时加载循环,typescript,angular8,Typescript,Angular8,当我添加一个函数来监听加载对象元素中的数据时,这个函数将进入一个加载无限循环 这只发生在Angular 8中,在我在Angular 4、6和7中使用相同的代码并正确工作之前 component.template.html 。。。 ... component.component.ts @ViewChild('object', { static: true }) object: ElementRef<HTMLObjectElement>; ... onObjectLoaded(

当我添加一个函数来监听加载对象元素中的数据时,这个函数将进入一个加载无限循环

这只发生在Angular 8中,在我在Angular 4、6和7中使用相同的代码并正确工作之前

component.template.html

。。。
...
component.component.ts

 @ViewChild('object', { static: true }) object: ElementRef<HTMLObjectElement>;
...
   onObjectLoaded() {
    this.svg = 
     this.object.nativeElement.contentDocument.querySelector('svg');
    this.onLoadObject.emit(true);
  }
...
@ViewChild('object',{static:true})object:ElementRef;
...
onObjectLoaded(){
this.svg=
this.object.nativeElement.contentDocument.querySelector('svg');
this.onLoadObject.emit(true);
}
...