[技術討論] angularJS $watch 係 angular2 冇左

以前用開
  1. $scope.$watch('abc',function(val,old){
  2. });
複製代碼
宜家angular2 冇左, 我只諗到用setInterval 去自己check, 但咁樣好死版, 又唔知set咁多setInterval 會唔會搞到個program 變得好慢.
有冇人知仲有咩方法?

TOP

Angular2 don't have scope but not no way to listen to Component value changes

TOP

由於我個處理兩個variables 係service 經http取回 所以無法用Component OnChange, 但我已經想到其他方法更新了, 會比用timer 好. 多謝各位意見.

TOP

由於我個處理兩個variables 係service 經http取回 所以無法用Component OnChange, 但我已經想到其他方法更 ...
wingwell 發表於 2017-3-6 09:04



Service的話我多數用EventEmitter....其實也是extend 自rxjs的Subject

TOP

發現一個function, 近似$watch, 不過check邊個value就自己搞.

ngOnChanges(changeRecord) {
    console.log(changeRecord);
  }

TOP

發現一個function, 近似$watch, 不過check邊個value就自己搞.

ngOnChanges(changeRecord) {
    console.l ...
wingwell 發表於 10/4/2017 01:46 PM



    lol you probably didn't even read the page I gave you weeks ago.

TOP

lol you probably didn't even read the page I gave you weeks ago.
Jackass_TMxCK 發表於 2017-4-10 18:28


係喎, 原來答案一早出現左. 多謝你先

TOP

angular js 已去到4

via HKEPC Reader for Android

TOP

angular js 已去到4

via HKEPC Reader for Android
takayo72 發表於 11/4/2017 08:15 PM



    Then?

TOP

相關文章