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

Commit

Permalink
fix(translateDirective): check for truthy value in watch callback
Browse files Browse the repository at this point in the history
- check if the watched value is truthy
- only replace contents with translation if truthy

Closes #18
  • Loading branch information
0x-r4bbit committed Apr 30, 2013
1 parent a154d9b commit 98087c7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ngTranslate/directive/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ angular.module('ngTranslate')
element.html(translate(scope.translationId, scope.interpolateParams));
});

scope.$watch('translationId + interpolateParams', function () {
element.html(translate(scope.translationId, scope.interpolateParams));
scope.$watch('translationId + interpolateParams', function (nValue) {
if (nValue) {
element.html(translate(scope.translationId, scope.interpolateParams));
}
});
}
};
Expand Down

0 comments on commit 98087c7

Please sign in to comment.