Skip to content

Commit

Permalink
fix(directive): Fix special IE11 issue angular-translate#925
Browse files Browse the repository at this point in the history
  • Loading branch information
knalli committed Sep 15, 2015
1 parent 379da12 commit c4b16d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/directive/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ function translateDirective($translate, $q, $interpolate, $compile, $parse, $roo
if (!successful && typeof scope.defaultText !== 'undefined') {
value = scope.defaultText;
}
iElement.html(scope.preText + value + scope.postText);
iElement.empty().append(scope.preText + value + scope.postText);
var globallyEnabled = $translate.isPostCompilingEnabled();
var locallyDefined = typeof tAttr.translateCompile !== 'undefined';
var locallyEnabled = locallyDefined && tAttr.translateCompile !== 'false';
Expand Down
6 changes: 3 additions & 3 deletions test/unit/directive/translate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,20 +252,20 @@ describe('pascalprecht.translate', function () {
$rootScope.translationId = 'TD_WITH_VALUE';
element = $compile('<div translate="{{translationId}}"></div>')($rootScope);
$rootScope.$digest();
expect(element.text()).toBe('Lorem Ipsum ');
expect(element.text()).toBe('Lorem Ipsum');
});

it('should replace interpolation directive with empty string if translation id is in content', function () {
element = $compile('<div translate>TD_WITH_VALUE</div>')($rootScope);
$rootScope.$digest();
expect(element.text()).toBe('Lorem Ipsum ');
expect(element.text()).toBe('Lorem Ipsum');
});

it('should replace interpolation directive with empty string if td id is in content and interpolation', function () {
$rootScope.translationId = 'TD_WITH_VALUE';
element = $compile('<div translate>{{translationId}}</div>')($rootScope);
$rootScope.$digest();
expect(element.text()).toBe('Lorem Ipsum ');
expect(element.text()).toBe('Lorem Ipsum');
});
});

Expand Down

0 comments on commit c4b16d3

Please sign in to comment.