Improve this Doc View Source $interpolate
- $interpolateProvider
- service in module ng
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 | uppercase}}!'); expect(exp({name:'Angular'}).toEqual('Hello ANGULAR!');
Dependencies
Usage
$interpolate(text, [mustHaveExpression], [trustedContext]);
Arguments
Param | Type | Details |
---|---|---|
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. |
trustedContext (optional) | string | when provided, the returned function passes the interpolated result through $sce.getTrusted(interpolatedResult, trustedContext) before returning it. Refer to the $sce service that provides Strict Contextual Escaping for details. |
Returns
function(context) |
an interpolation function which is used to compute the interpolated string. The function has these parameters:
|
Methods
-
startSymbol();
Symbol to denote the start of expression in the interpolated string. Defaults to
{{
.Use
$interpolateProvider.startSymbol
to change the symbol.Returns
string
start symbol.
-
endSymbol();
Symbol to denote the end of expression in the interpolated string. Defaults to
}}
.Use
$interpolateProvider.endSymbol
to change the symbol.Returns
string
end symbol.
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://code.angularjs.org/1.2.32/docs/api/ng/service/$interpolate