页脚模板闪烁,即使使用AngularJS NG-斗篷 [英] Footer template blinks even using ng-cloak in AngularJS

查看:367
本文介绍了页脚模板闪烁,即使使用AngularJS NG-斗篷的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我SUCESSFUL创建和使用,但使用AngularJS从REST服务检索一些数据,当JSON响应仍在加载时,浏览器显示页脚模板的顶部,并且当反应返回JSON数据显示模板,页脚去到了谷底。

I'm sucessful create and display templates with some data retrieved from REST service using AngularJS but, when JSON response is still loading, the browser show the footer template at the top and, when response return the JSON data, the footer goes to the bottom.

这发生得非常快,但页脚模板页面顶部的闪烁之前去的底部。

This occurs very quickly, but the footer template blinks at the top of the page before goes to the bottom.

我用NG-披风的办法,遗憾的是,问题仍然发生试过。我把CSS到NG-披风作为参考建议。

I've tried using the ng-cloak approach, unfortunately, the problem still happening. I put the CSS to ng-cloak as the API Reference recommend.

下面是我的应用程序code:

Here is my app code:

<body>
  <div data-ng-controller="HeaderCtrl" data-ng-include="'app/partials/header.html'"></div>
  <div data-ng-controller="MenuCtrl" data-ng-include="'app/partials/lista-menu.html'"></div>
  <div ng-view="main" ></div>
  <footer class="nav" data-ng-include="'app/partials/footer.html'" ></footer>

我尽量把身体标记,NG-观点,页脚中的NG-斗篷,也是NG-查看HTML模板中。这code再presents所有尝试(注:我尝试单独和共同使用,具有NG-披风类,而不是)

I try put the ng-cloak on body tag, ng-view, footer, and also inside the ng-view html template. This code represents all attempts (Note: I've try to use separately and together, with ng-cloak class and not)

<body ng-cloak class="ng-cloak">
  <div data-ng-controller="HeaderCtrl" data-ng-include="'app/partials/header.html'"></div>
  <div data-ng-controller="MenuCtrl" data-ng-include="'app/partials/lista-menu.html'"></div>
  <div ng-view="main" ng-cloak class="ng-cloak"></div>
  <footer class="nav" data-ng-include="'app/partials/footer.html'" ng-cloak class="ng-cloak"></footer>

不幸的是所有这些变化后,页脚模板仍然在顶部闪烁之前加载完成。

Unfortunately after all these changes, the footer template still blink on top before loading is complete.

任何人都可以帮我解决这个问题?

Anyone can help me to fix this?

时的任何引导的技巧把页脚位于底部,即使主分区是不高?我试着用导航,固定底部的标签,但我不希望有底部固定在屏幕上,当页面有很高的高度值。

Is any Bootstrap trick to put the footer on bottom, even when the main div is without height? I've tried use the nav-fixed-bottom tag but I dont want to have the bottom fixed on screen when the page has high height values.

谢谢!

推荐答案

NG-斗篷和/或的 NG-绑定不能帮助解决这个问题,因为这不是一个的未编译内容的问题闪光灯。这些指令旨在直到角有机会编译HTML隐藏的内容。

ng-cloak and/or ng-bind can't help solve this problem, because this is not a "flash of uncompiled content" problem. Those directives are meant to hide content until Angular has had a chance to compile the HTML.

您正在试图解决这个问题更像是:我动态地添加东西页面和东西正在走动。如果你想显示页脚的主要内容只加载后,我喜欢他的意见psented解决@Alex $ P $。

The problem you are trying to solve is more like: "I'm adding stuff to the page dynamically and stuff is moving around". If you want to show the footer only after the main content is loaded, I like the solution @Alex presented in his comment.

这篇关于页脚模板闪烁,即使使用AngularJS NG-斗篷的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆