javascript - when using $compile why do images take a long time to load? -


I am using an instruction that looks like an HTML file in angled page:

 . Directive ("injection", ['$ compile', 'toolsService', ($ compilation, tool service, type) - & gt; Scope: true link: (field, element, attrs) -> type = attrs WidgetType attrs $ $ "Template", (template) -> if display angular.isDefined (template) and "template" template # compiled the template against current scope el = $ compilation (template) # to empty The stupid way to add Element element.html "# # Template Content Elements. App L  

This works fine Yes but the problem is that an image inside the compiled html (indicating that the app is still calculating the values ​​going inside that part of the page) the way the page is delayed in the way of life. / P>

If the HTML looks like this:

  Lieutenant !! - Compiled HTML -> gt; & lt; img src = "img / yellow-refresh-2" Gif "> <> - Compiled HTML -> gt; ng-init =" data.refreshing = true; data.error = false; "& gt; & lt; div & gt; {{ Data.refreshing}} & lt; / div & gt; & Lt; Div class = "header" & gt; & Lt; H5 class = "ib alias ng-binding" & gt; This title is & lt; / H5> & Lt; Div class = "data status is right" & gt; & Lt; Img ng-hide = "data.refreshing == false" src = "img / yellow-refresh-2.gif" class = "ind refresh ng-hiding" & gt; & Lt; Img ng-hide = "data.refreshing || data.error" class = "good" & gt; & Lt; Img ng-show = "data.error" class = "inner error ng-hide" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; IMG will appear immediately outside the compiled HML, but the same IMG with the same source inside the compiled HTML will later be visible about a full second. Actually my code can ask the database to be aggregated on a large record set and displays those results (inside the compiled HTML)  before  the image inside the compiled HTML is showing  

{{data.refreshing}} is appearing on the page and it is correct when the page loads. When the data comes back from the DB call, I can switch it to the wrong. After the template compilation, HTML ( {{data.refreshing}} is particularly visible, while the latter picture is shown in the next half-second time - but on the same picture above the page When the page loads, it appears at the top.

Important Note: This is the first page load (Ctrl F5), so it is more likely to be a problem. But this is not just a loading problem. Because all examples include compiled HT Img is visible outside the ML

How do I get the image inside the compiled HTML to show quickly? As compiled HTML it should be visible as well ... OK, compiled < / P>


Comments

Popular posts from this blog

eclipse plugin - Run java code error: Workspace is closed -

ios - How do I use CFArrayRef in Swift? -

scala - Play Framework - how to bind form to a session field -