Rendering Delay with Angular + jQuery

0

Some jQuery functions or Angular directives are not loaded or rendered while loading the page.

At various points in APP I had to apply the timeout to run everything normally.

I'm currently loading the angle like this, and right below I load jquery, it was the only solution to work, even with timeout:

angular.element(document).ready(function(){
    angular.bootstrap(document, ['app']);

        jQuery(function($){
            $(window).load(function(){
                if($("‪#‎selection‬").length)
                    $(".languages").show();

What's the right way to use both at the same time and render everything without timeout?

    
asked by anonymous 07.10.2015 / 22:57

1 answer

1

This is a very common question, the angular one actually renders page elements and directive without having loaded some elements, this is normal. To fix this, there is a directive of the angular core itself called ngCloak, you can see how to use it here in the documentation: link

Note that you need to include the css to drop elements with the ngCloak attribute as stated in the policy specification.

[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
  display: none !important;
}
    
07.10.2015 / 23:15