[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 @ 2015-10-20 23:08  Zhentiw  阅读(247)  评论(0编辑  收藏  举报