The compiler adds the $watch method for watches the changes in the string.
If we want to use different beginning and ending symbols in our application for binding the string, we can modify them by configuring the $interpolateProvider.
The default symbol of expression is {{ (open curly braces) and }} (closing curly braces).
To modify the beginning string, we can set the starting symbol with the startSymbol() method.
To modify the ending string, we can set the ending symbol with the endSymbol() method.
Example for interpolation:
Methods of Interpolation in AngularJS:
Methods
Description
startSymbol()
This method is used the symbol to denote the start of expression in the interpolated string. Default to {{.
endSymbol()
This method is used the symbol to denote the end of expression in the interpolated string. Default to }}.
Syntax for Interpolation in AngularJS:
Syntax for $interpolate service
Parameter value for $interpolate Service in AngularJS:
Value
Type
Description
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. String 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.
allOrNothing(optional)
boolean
if true then the returned function returns undefined unless all embedded expressions evaluate to a value other than undefined.
Syntax for $interpolateProvider
Parameter value for $interpolateProvider in AngularJS:
Value
Type
Description
value (optional)
string
New value to set the starting symbol to.
value (optional)
string
New value to set the ending symbol to.
Sample code for Interpolation with $interpolateProvider in AngularJS:
$interpolateProvider:
$interpolateProvider configuration of Application Module.
Code Explanation for $interpolateProvider in AngularJS: