Compiles a string with markup into an interpolation function. This service is used by the
HTML $compile
service for data binding. See
$interpolateProvider
for configuring the
interpolation markup.
var $interpolate = ...; // injected var exp = $interpolate('Hello {{name}}!'); expect(exp({name:'Angular'}).toEqual('Hello Angular!');
$interpolate(text[, mustHaveExpression]);
text – {string} –
The text with markup to interpolate.
mustHaveExpression(optional) – {boolean=} –
if set to true then the interpolation string must have embedded expression in order to return an interpolation function. Strings with no embedded expression will return null for the interpolation function.
{function(context)}
– an interpolation function which is used to compute the interpolated string. The function has these parameters:
context
: an object against which any expressions embedded in the strings are evaluated
against.