如何去除ngShow延迟初始化? NG-斗篷当不成? [英] How to remove delay from ngShow initialization? When ng-cloak fails?

查看:274
本文介绍了如何去除ngShow延迟初始化? NG-斗篷当不成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我碰到的确切同样的问题,在这个问题上找到。但是两个答案并没有我的情况下工作。

我的问题视频: https://www.youtube.com/watch?v=ByjmwmamemM

在我的应用程序的负载,有几个popovers上所有的人都NG-秀检查。他们都开始了假然而 3-4秒(长时间)的popovers露面,然后消失。

据我联系到上面,我应该尝试在头部分顶部加载角问题的答案,如果不行再加入 .ng披风我的CSS和有问题的的div

这两个没有工作:(

在其他人之前遇到这个问题?

的index.html:

 <机身NG-应用=tickertags>    <格UI的视图>< / DIV>

dashboard.html < - 装入用户界面视图第一个模板

 < D​​IV NG控制器=DashCtrl>
    <顶通知>< /顶通知>
    <警报,面板>< /警报,面板>
    <搜索酥料饼>< /搜索酥料饼>
    <标记,搜索和GT;< /标签搜索>
    <标记,滤光器>< /标签,滤光器>    < D​​IV CLASS =破折号体NG点击=bodyClick()>
        <报头GT;
            <平台的头>< /平台的头>
            <控制头>< /控制头>
            <查看头>< /视图头>
        < /头>        <行情,面板>< /行情-面板>
        <标签,面板>< /标签,面板>        <节ID =面板的活动级=活动面板>
            <表头>< /图头>
            <图-IQ>< /图-IQ>
            <社会化媒体,面板>< /社交媒体 - 面板>
        < /节>
    < / DIV>    <&覆盖GT;< /覆盖>
< / DIV>


的popovers:

searchPopover:(隐藏前3-4秒)

 < D​​IV NG秀=searchPopoverDisplay级=搜索酥料饼NG-斗篷>

tagSearchPopover:(隐藏前3-4秒)

 < D​​IV NG秀=tagsSearch.tagsFuzzyResults类=标签的搜索酥料饼NG-斗篷>

tagFilterPopover:(小于 - 这酥料饼消失最快的速度,1.5秒)

 < D​​IV NG秀=tagsFilterOn类=标签过滤器,酥料饼NG点击=captureClick()NG-斗篷>

NG-斗篷

  // NG-斗篷
[NG \\:披风]
[NG-披风]
[数据-NG-披风]
[X-NG-披风]
.ng披风,
.X-NG-斗篷{
    !显示:无重要;
}


解决方案

隐藏它们在默认情况下在CSS中,然后覆盖在角负载。 3-4秒的延迟可能是它采取获取和加载角之中你正在做(你应该检查你的网络的面板),其他请求的时间。

 。显示上{
    !显示:块重要;
    不透明度:1重要;
}


 纳克级={显示在线:searchPopoverDisplay}

I've run into the exact same problem found in this question. However both answers did not work in my case.

Video of my problem: https://www.youtube.com/watch?v=ByjmwmamemM

When my app loads, there are several popovers with ng-show checks on all of them. They all start out false however for 3-4 secs (long time) the popovers show up, then disappear.

According to the answer in the question I linked to above I should try to load Angular at the top in the head section, and if that doesn't work then add .ng-cloak to my CSS and to the divs in question.

Both did not work :(

Anyone else run into this problem before?

Index.html:

<body ng-app="tickertags">

    <div ui-view></div>

dashboard.html <- first template loaded into ui-view

<div ng-controller="DashCtrl">
    <top-notification></top-notification>
    <alerts-panel></alerts-panel>
    <search-popover></search-popover>
    <tags-search></tags-search>
    <tags-filter></tags-filter>

    <div class="dash-body" ng-click="bodyClick()">
        <header>
            <platform-header></platform-header>
            <control-header></control-header>
            <view-header></view-header>
        </header>

        <tickers-panel></tickers-panel>
        <tags-panel></tags-panel>

        <section id="panel-activity" class="activity-panel">
            <chart-header></chart-header>
            <chart-iq></chart-iq>
            <social-media-panel></social-media-panel>
        </section>
    </div>

    <overlay></overlay>
</div>


The popovers:

searchPopover: (3-4 secs before hiding)

<div ng-show="searchPopoverDisplay" class="search-popover" ng-cloak>

tagSearchPopover: (3-4 secs before hiding)

<div ng-show="tagsSearch.tagsFuzzyResults" class="tag-search-popover" ng-cloak>

tagFilterPopover: (<- this popover disappears the fastest, .5 sec)

<div ng-show="tagsFilterOn" class="tags-filter-popover" ng-click="captureClick()" ng-cloak>

ng-cloak

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

解决方案

Hide them by default in css, then override when angular loads. The 3-4 second delay could be the time it's taking to fetch and load angular amidst all the other requests you're making (you should check your network panel).

.display-on {
    display: block !important;
    opacity: 1 !important;
}


ng-class="{'display-on': searchPopoverDisplay}"

这篇关于如何去除ngShow延迟初始化? NG-斗篷当不成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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