Skip to content

angular performance

Sébastien LUCAS edited this page Aug 28, 2014 · 5 revisions

Links

Perfomance best pratice

Remove a event handler on scope $destroy

angular.module('test')
   .controller('QuestionsStatusController2',
   ['$rootScope', '$scope', '$resource', '$state',
   function ($rootScope, $scope, $resource, $state) {

    var cleanUpFunc = $rootScope.$on('action2@QuestionStatusController1', function {
         //write your listener here
    });

    $scope.$on('$destroy', function() {
        cleanUpFunc();
    };

   }]);

WIKI by Sébastien Lucas CEO & Funder or Bricks

Clone this wiki locally