HTML显示结果NG-如果评估在angularjs正规前pression前 [英] html shows the result before ng-if evaluates the regular expression in angularjs

查看:162
本文介绍了HTML显示结果NG-如果评估在angularjs正规前pression前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

\r
\r

< D​​IV CLASS =警戒警报的危险隐藏-XS角色=警惕NG-IF =OrderDetails.length == 0的风格=FONT-SIZE:大;字体舒展:扩大;\r
    字体重量:大胆;>\r
  \r
  \r
< P>我们很抱歉,您目前还没有最后的订单细节,但你想过项都将自动在您的订单中添加< / P>\r
  \r
  \r
    < / DIV>

\r

\r
\r

你可以从上面的控制器上我的浏览器上面的html负荷我的结果加载之前看到的,是可用来显示我的网络上的任何方法可以让我prevent这个div我的结果加载之前加载和页面?


解决方案

看看为的 NG-斗篷

从文档:


  

该ngCloak指令通过在其原始(未编译)形式的浏览器,而你的应用程序加载被短暂显示用于prevent的角度HTML模板。使用这个指令以避免造成HTML模板显示不良闪烁效果。


 <输入ID =搜索NG-IF =someConditionNG-斗篷>

<div class="alert alert-danger hidden-xs" role="alert" ng-if="OrderDetails.length == 0" style="font-size: large; font-stretch: expanded;
    font-weight: bold;">
  
  
<p>We're sorry,you currently have no last Order details, but items you've thought will be added automatically when you place an order.</p>
  
  
    </div>

Hi, as you can see from above before my result loads from controller the above html loads on my browser, is there any way I can prevent this div to load before my result loads and available to show on my web page?

解决方案

Take a look at the documentation for ng-cloak

From the documentation:

The ngCloak directive is used to prevent the Angular html template from being briefly displayed by the browser in its raw (uncompiled) form while your application is loading. Use this directive to avoid the undesirable flicker effect caused by the html template display.

<input id = "search"  ng-if="someCondition" ng-cloak> 

这篇关于HTML显示结果NG-如果评估在angularjs正规前pression前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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