活到老学到老  

记录遇到问题的点点滴滴。

[Chrome扩展开发] Angular的ng-show和ng-hide不生效解决

7年前发布  · 2005 次阅读

开发Chrome扩展的时候AngularJs的ng-show和ng-hide不生效的原因是扩展的一些安全策略导致的。

引入CSS文件即可

<link rel="stylesheet" href="https://code.angularjs.org/1.2.21/angular-csp.css">

以下CSS是给没翻墙的小伙伴用的:

angular-csp.css

/* 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 {
    display: none !important;
}

ng\:form {
    display: block;
}

.ng-animate-block-transitions {
    transition: 0s all!important;
    -webkit-transition: 0s all!important;
}

/* show the element during a show/hide animation when the
 * animation is ongoing, but the .ng-hide class is active */
.ng-hide-add-active, .ng-hide-remove {
    display: block!important;
}
 

 

PS: 要使用本站的免费翻墙,点击导航栏的Shadowsocks