Can angular $ timeout be used as a reliable home?

Work with the library, which should be called after the dom is ready. And I just used the init function with $ timeout from init.

Can $ timeout be used as a reliable readiness event at home?

Thank.

+4
source share
1 answer

AngularJS will load the application when static DOM content is loaded. You can see in the diagram below that AngularJS also has a dynamic DOM that is created when directives are compiled and linked.

concepts-startup.png

$timeout, , $digest, stabalised:

link: function() {
    $timeout(function() {
       // after $digest
       // dynamic DOM ready
    });
}
+6

Source: https://habr.com/ru/post/1570706/


All Articles