search

Home  >  Q&A  >  body text

angular.js - AngularJS通过controller A 到controller B

首先进入controller A
然后 判断是显示 controller A 的 dom 还是 直接显示 controller B的dom
可是不管怎么搞都会先 渲染 A的dom 然后闪一下才进入 B的dom 求大神指点?

高洛峰高洛峰2744 days ago528

reply all(4)I'll reply

  • 为情所困

    为情所困2017-05-15 17:02:59

    Generally used in this situationng-if

    reply
    0
  • PHPz

    PHPz2017-05-15 17:02:59

    Controller itself has no DOM. Do you mean ng-controller, component, directive or route?

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-15 17:02:59

    Go to Angular’s ​​class library and find a file named angular-csp and import it. The content is like this

    /* Include this file in your html if you are using the CSP mode. */
    
    @charset "UTF-8";
    
    [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak],
    .ng-cloak, .x-ng-cloak,
    .ng-hide:not(.ng-hide-animate) {
      display: none !important;
    }
    
    ng\:form {
      display: block;
    }
    
    .ng-animate-shim {
      visibility:hidden;
    }
    
    .ng-anchor {
      position:absolute;
    }

    Then add ng-cloakattributes to your flash elements

    <p ng-if="false" ng-cloak>Hello World</p>

    reply
    0
  • PHP中文网

    PHP中文网2017-05-15 17:02:59

    I agree with the first floor. To judge the display of DOM, use ng-if directly on the HTML page. If the result is true, the DOM will be rendered. If not, it will not be rendered.

    reply
    0
  • Cancelreply