1

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?

Shamil Yakupov
  • 5,409
  • 2
  • 16
  • 21

1 Answers1

1

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)

Community
  • 1
  • 1
A G
  • 21,087
  • 11
  • 87
  • 112
  • I have already tryed `$viewContentLoaded` but with no result. It's loaded tooltips in static content, but not in the ngRepeats. – Shamil Yakupov Feb 18 '15 at 19:10