简体   繁体   English

ng-include 和 ng-view 未同时加载

[英]ng-include and ng-view not loading at the same time

below is the structure of my app.下面是我的应用程序的结构。 very simple.很简单。 header and footer are very small files.页眉和页脚是非常小的文件。 while the ng-view on homepage is much bigger.而主页上的ng-view要大得多。 I noticed that when i enter the page.我注意到当我进入页面时。 the two ng-include get loaded first, then the ng-view come up and footer get pushed to the bottom.两个 ng-include 首先加载,然后 ng-view 出现并且页脚被推到底部。 the footer flashes for like 0.1 sec, but it's in a different color.页脚闪烁 0.1 秒,但颜色不同。 so it is quite clear to me.所以我很清楚。

    <div ng-include='"app/core/templates/header.html"'></div>
    <div ng-view autoscroll="true"></div>
    <div ng-include='"app/core/templates/footer.html"'></div>

Is there anyway to have them finish loading at the same time.无论如何让它们同时完成加载。 and display all together?并一起显示? or anyway to make it more smooth?或者无论如何让它更平滑?

There is ng-cloak in angular you can show other div until loading finishes In cases where you are loading angular.js in the body or templates aren't compiled soon enough, use the ng-cloak directive and include the following in your CSS: angular 中有 ng-cloak 您可以在加载完成之前显示其他 div 如果您在主体中加载 angular.js 或模板没有及时编译,请使用 ng-cloak 指令并在您的 CSS 中包含以下内容:

/* 
  Allow angular.js to be loaded in body, hiding cloaked elements until 
  templates compile.  The !important is important given that there may be 
  other selectors that are more specific or come later and might alter display.  
 */
[ng\:cloak], [ng-cloak], .ng-cloak {
  display: none !important;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM