Skip to content
forked from ansukla/ng-perf

Code add ons to improve performance of AngularJS apps

Notifications You must be signed in to change notification settings

ruiaraujo/ng-perf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ng-perf is a set of utilities to help with AngularJS performance.

ngp-local-*

A set of events that invoke $scope.digest() instead of $rootScope.apply. This will help with directives where the result of events only needs to be applied to the current scope and downward instead of all the way from rootScope. These events also provide a way to supress the digest altogether via preventDefault method.

To use directives

	bower install ng-perf

Include ngPerfLocalDirectives.js and add module ngPerf.directives as a dependency

Here's an example directive using ngp-local-click.

angular.module('ngPerf.randomButton', ['ngPerf.directives'])
    .directive('randomButton', function() {
        return {
            restrict: 'EA',
            scope: {},
            controller: function($scope) {
                $scope.randomNumber = '123';
                $scope.generateRandom = function() {
                    $scope.randomNumber = Math.floor(Math.random()*100);
//                    event.preventDefault(); //uncomment to suppress digest altogether
                }
            },
            template: '<button ngp-local-click="generateRandom(event)">Random</button><span ng-bind="randomNumber"></span>',
            link: function(){}
        };
    });

About

Code add ons to improve performance of AngularJS apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 63.5%
  • JavaScript 36.5%