[AngularJS] Enable Animations Explicitly For A Performance Boost In AngularJS

http://www.bennadel.com/blog/2935-enable-animations-explicitly-for-a-performance-boost-in-angularjs.htm?utm_campaign=NG-Newsletter&utm_medium=email&utm_source=NG-Newsletter_119

 

复制代码
angular.module( "Demo" ).config(
            function configureAnimate( $animateProvider ) {
                // By default, the $animate service will check for animation styling
                // on every structural change. This requires a lot of animateFrame-based
                // DOM-inspection. However, we can tell $animate to only check for
                // animations on elements that have a specific class name RegExp pattern
                // present. In this case, we are requiring the "animated" class.
                // --
                // NOTE: I have personally seen a performance boost using this approach
                // on some complex page. The AngularJS documentation also says that
                // this can also be really beneficial for low-powered mobile devices,
                // but I don't do much mobile.
                $animateProvider.classNameFilter( /\banimated\b/ );
            }
        );
复制代码
<li ng-repeat="item in activeList" class="animated">
            {{ item }}
 </li>

 

posted @   Zhentiw  阅读(249)  评论(0编辑  收藏  举报
(评论功能已被禁用)
编辑推荐:
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
阅读排行:
· 在鹅厂做java开发是什么体验
· 百万级群聊的设计实践
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
· 永远不要相信用户的输入:从 SQL 注入攻防看输入验证的重要性
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
点击右上角即可分享
微信分享提示