如何停止角度6 HTML(更改检测)功能

时间:2020-06-19 01:01:04

标签: javascript angular

我的Angular html中有一个函数,该函数从服务中的共享库中检索值。问题是我希望Angular关闭更改检测,以便函数不会连续执行。我只能在ngOnInit上检索参数,因此无法运行该函数。我已经看到有关此问题的讨论,但没有解决方案。...2020年是否有解决方案?这是代码:

.html


   <td [ngStyle]="{'border-top': ezzy.getThemeBorderColor()}" attr.dataTh="{{ezzy.LOCALIZATION.price}}">{{response.price*ezzy.getFxRate(respondedList.country) | number:'1.2-2'}}</td>

ngOnInit

    ....
    ....
        window.customSocket.emit('getRespondedList'); // GET LIST FROM SERVER
        window.customSocket.on('respondedList', (data: any) => {
          window.customSocket.off('respondedList');
          this.respondedList = data.respondedList;
          this.respondedListReponsesCount = data.dealerCount;
       .......
        });

0 个答案:

没有答案