How to trigger a method when Angular is done adding scope updates to the DOM?

前端 未结 6 668
余生分开走
余生分开走 2020-11-29 21:50

I am looking for a way to execute code when after I add changes to a $scope variable, in this case $scope.results. I need to do this in order to call some legacy code that r

6条回答
  •  清歌不尽
    2020-11-29 22:07

    interval works for me,for example:

    interval = $interval(function() {
        if ($("#target").children().length === 0) {
            return;
        }
        doSomething();
        $interval.cancel(interval);
    }, 0);
    

提交回复
热议问题