Angular JS指令范围。$ watch进入Angular 6

时间:2018-09-07 23:29:41

标签: angular6

    In angular 1, The code was written like this.


**AngularJS**:

    scope.$watch('hiddenScroll', () => {
              $timeout(this.updateFadersVisibility());
            });



    **Angular 6**

    ngOnChanges(changes: any) {
      setTimeout(() => {
          this.updateFadersVisibility();
        }, 1000);
      }

我正在寻找更好的解决方案。 ngOnChanges无法正常工作。

0 个答案:

没有答案