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

Commit

Permalink
fix(translateDirective): fixes scope handling
Browse files Browse the repository at this point in the history
  • Loading branch information
0x-r4bbit committed Aug 22, 2013
1 parent e4b3cad commit c566586
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/directive/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ angular.module('pascalprecht.translate')

return {
restrict: 'AE',
scope: true,
link: function linkFn(scope, element, attr) {

if (attr.translateInterpolation) {
Expand All @@ -91,7 +92,7 @@ angular.module('pascalprecht.translate')
// If the attribute has no content, the element's text value (white spaces trimmed off) will be used.
attr.$observe('translate', function (translationId) {
if (angular.equals(translationId , '') || translationId === undefined) {
scope.translationId = $interpolate(element.text().replace(/^\s+|\s+$/g,''))(scope);
scope.translationId = $interpolate(element.text().replace(/^\s+|\s+$/g,''))(scope.$parent);
} else {
scope.translationId = translationId;
}
Expand Down

0 comments on commit c566586

Please sign in to comment.