diff --git a/src/ng/compile.js b/src/ng/compile.js index 0b83a7bae39f..90646165d9b6 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -1559,7 +1559,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { var startSymbol = $interpolate.startSymbol(), endSymbol = $interpolate.endSymbol(), - denormalizeTemplate = (startSymbol == '{{' || endSymbol == '}}') + denormalizeTemplate = (startSymbol == '{{' && endSymbol == '}}') ? identity : function denormalizeTemplate(template) { return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol); diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 47f8e9ec9046..240906721a33 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -3137,6 +3137,54 @@ describe('$compile', function() { }); + it('should support custom start interpolation symbol, even when `endSymbol` doesn\'t change', + function() { + module(function($compileProvider, $interpolateProvider) { + $interpolateProvider.startSymbol('[['); + $compileProvider.directive('myDirective', function() { + return { + template: '{{ hello }}|{{ hello | uppercase }}' + }; + }); + }); + + inject(function($compile, $rootScope) { + var tmpl = '
[[ hello | uppercase }}|
'; + element = $compile(tmpl)($rootScope); + + $rootScope.hello = 'ahoj'; + $rootScope.$digest(); + + expect(element.text()).toBe('AHOJ|ahoj|AHOJ'); + }); + } + ); + + + it('should support custom end interpolation symbol, even when `startSymbol` doesn\'t change', + function() { + module(function($compileProvider, $interpolateProvider) { + $interpolateProvider.endSymbol(']]'); + $compileProvider.directive('myDirective', function() { + return { + template: '{{ hello }}|{{ hello | uppercase }}' + }; + }); + }); + + inject(function($compile, $rootScope) { + var tmpl = '
{{ hello | uppercase ]]|
'; + element = $compile(tmpl)($rootScope); + + $rootScope.hello = 'ahoj'; + $rootScope.$digest(); + + expect(element.text()).toBe('AHOJ|ahoj|AHOJ'); + }); + } + ); + + it('should support custom start/end interpolation symbols in async directive template', function() { module(function($interpolateProvider, $compileProvider) {