angular/angular.js — pull request #7517 by caitp (2014-05-20 08:20:13+00:00)
Title: feat($interpolate): escaped interpolation expressions

This CL enables interpolation expressions to be escaped, by prefixing each
character of their start/end markers with a REVERSE SOLIDUS U+005C, and to
render the escaped expression as a regular interpolation expression.

Example:

`{{foo}}, \\{\\{World!\\}\\}` would be
rendered as:
`Hello, {{World!}}`

This will also work with custom interpolation markers, for example:

module.
config(function($interpolateProvider) {
$interpolateProvider.startSymbol('\\\\');
$interpolateProvider.endSymbol('//');
}).
run(function($interpolate) {
// Will alert with "hello\\bar//":
alert($interpolate('\\\\foo//\\\\\\\\bar\\/\\/')({foo: "hello", bar:
"world"}));
});

This change effectively only changes the rendering of these escaped markers,
because they are not context-aware, and are incapable of preventing nested
expressions within those escaped markers from being evaluated.

Therefore, backends are encouraged to ensure that when escaping expressions
for security reasons, every single instance of a start or end marker have each
of its characters prefixed with a backslash (REVERSE SOLIDUS, U+005C)

Closes #5601