鉴于初始化加载后提示初始化、加载、提示

2023-09-13 03:55:48 作者:芝士焗番薯

如何我的看法是加载后(所有NG-等重复完成)初始化引导提示?结果我已经tryed只包括 $('[数据切换=提示]')提示(); 在我的控制器的底部,但它不是初始化工具提示在ngRepeats。

有哪些射击的看法是否有所改变?

任何事件解决方案

您可以尝试 $ viewContentLoaded 事件。

  

发出的每一道的ngView内容被重新装载时间。

  $范围。在$('$ viewContentLoaded',函数(事件){    的console.log('内容装!')  }); 

有没有事件,以通知纳克重复完成。你可以用的NG-重复的指令,然后再检查范围。$最后是真实的。此外,还可以使用$ evalAsync确保DOM被构造后执行的回调/功能。

 如果(范围。$最后一个){   范围$ evalAsync(attr.someCallback)。} 
运行时错误 35613

NG-重复完成事件

Calling函数时NG-重复已经完成

小提琴($ evalAsync)

How to initialize Bootstrap tooltips after my view is loaded (all ng-repeats etc. are done)? I have tryed to just include $('[data-toggle="tooltip"]').tooltip(); at the bottom of my controller, but it's not initializing tooltips in ngRepeats.

Is there any events which firing on any change of view?

解决方案

You can try the $viewContentLoaded event.

Emitted every time the ngView content is reloaded.

$scope.$on('$viewContentLoaded', function(event){
    console.log('content loaded!')
  });

There is no event to notify ng-repeat finish. You can wrap the ng-repeat in a directive and then check for scope.$last to be true. In addition you can use $evalAsync to make sure that the callback/function is executed after DOM is constructed.

if (scope.$last) {
   scope.$evalAsync(attr.someCallback);
}

ng-repeat finish event

Calling a function when ng-repeat has finished

fiddle ($evalAsync)