角JS NG-视图渲染事件视图、事件、JS、NG

2023-09-13 04:49:41 作者:凉心凉意凉少年

如何才能知道什么时候NG-视图完全呈现。目前,我曾尝试使用

  $范围。在$('$ viewContentLoaded',函数(){}$范围。在('$ routeChangeSuccess',函数(){} $angular.element(文件)。就绪(函数(){} 

但所有这些观点被渲染之前触发。

解决方案

正如我在注释中,使用的onload 中的 NG-视图 揭秘 Vue.js 九个性能优化技巧

How can I know when ng-view is completely rendered. Currently I have tried to use

$scope.$on('$viewContentLoaded', function() { }
$scope.$on('$routeChangeSuccess', function() { }
angular.element(document).ready(function() { }

but all these are firing before view is rendered.

解决方案

As I mentioned in the comment, use the onload argument of the ng-view directive