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

前端 未结 6 669
余生分开走
余生分开走 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:08

    Using timeout is not the correct way to do this. Use a directive to add/manipulate the DOM. If you do use timeout make sure to use $timeout which is hooked into Angular (for example returns a promise).

提交回复
热议问题