首页 > Web开发 > 详细

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

时间:2015-10-21 00:09:31      阅读:320      评论:0      收藏:0      [点我收藏+]

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>

 

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

原文:http://www.cnblogs.com/Answer1215/p/4896405.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!