diff --git a/src/ng/interpolate.js b/src/ng/interpolate.js index 3011e8c64017..149f0c868963 100644 --- a/src/ng/interpolate.js +++ b/src/ng/interpolate.js @@ -89,7 +89,7 @@ function $InterpolateProvider() { * against. * */ - return function(text, mustHaveExpression) { + function $interpolate(text, mustHaveExpression) { var startIndex, endIndex, index = 0, @@ -141,7 +141,43 @@ function $InterpolateProvider() { fn.parts = parts; return fn; } - }; + } + + + /** + * @ngdoc method + * @name ng.$interpolate#startSymbol + * @methodOf ng.$interpolate + * @description + * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`. + * + * Use {@link ng.$interpolateProvider#startSymbol $interpolateProvider#startSymbol} to change + * the symbol. + * + * @returns {string} start symbol. + */ + $interpolate.startSymbol = function() { + return startSymbol; + } + + + /** + * @ngdoc method + * @name ng.$interpolate#endSymbol + * @methodOf ng.$interpolate + * @description + * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`. + * + * Use {@link ng.$interpolateProvider#endSymbol $interpolateProvider#endSymbol} to change + * the symbol. + * + * @returns {string} start symbol. + */ + $interpolate.endSymbol = function() { + return endSymbol; + } + + return $interpolate; }]; } diff --git a/test/ng/interpolateSpec.js b/test/ng/interpolateSpec.js index 88e4ae75fdbd..2021444511b6 100644 --- a/test/ng/interpolateSpec.js +++ b/test/ng/interpolateSpec.js @@ -113,6 +113,11 @@ describe('$interpolate', function() { })); + it('should expose the startSymbol in run phase', inject(function($interpolate) { + expect($interpolate.startSymbol()).toBe('(('); + })); + + it('should not get confused by matching start and end symbols', function() { module(function($interpolateProvider) { $interpolateProvider.startSymbol('--'); @@ -139,5 +144,10 @@ describe('$interpolate', function() { it('should expose the endSymbol in config phase', module(function($interpolateProvider) { expect($interpolateProvider.endSymbol()).toBe('))'); })); + + + it('should expose the endSymbol in run phase', inject(function($interpolate) { + expect($interpolate.endSymbol()).toBe('))'); + })); }); });