Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
fix(directive): improve the cloak-directive's performance
Browse files Browse the repository at this point in the history
This removes the listener immediately it was invoked the first time.
  • Loading branch information
knalli authored and 0x-r4bbit committed Aug 3, 2014
1 parent 98fe649 commit acab18a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/directive/translate-cloak.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ angular.module('pascalprecht.translate')

return {
compile: function (tElement) {
$rootScope.$on('$translateChangeEnd', function () {
var removeListener = $rootScope.$on('$translateChangeEnd', function () {
tElement.removeClass($translate.cloakClassName());
removeListener();
removeListener = null;
});
tElement.addClass($translate.cloakClassName());
}
Expand Down

0 comments on commit acab18a

Please sign in to comment.