AngularJS $interpolateProvider Example

                                 
AngularJS provide $interpolateProvider for configuring the start and end symbol of expression.AngularJS expression takes double curly braces {{expression}} by default.Using startSymbol() and endSymbol() method we can change these default value to a different tag.In this demo,"We will use $interpolateProvider to change the start and end tag of AngularJS expression".Below code has the use of startSymbol() and endSymbol() method to change the AngularJS expression start and end tag to double square bracket.<!DOCTYPE html>
<html ng-app="myApp">

<head>
<script src="http://www.tutorialsavvy.com//ajax.go...
<meta charset="utf-8">
<title>AngularJS $interpolateProvider Example</title>
</head>

<body ng-controller="MyController">
<h3>$interpolateProvider startSymbol() and endSymbol</h3>
<h4>[[myName]]</h4>
<script>
var myApp = angular.module("myApp", []);

myApp.config(function($interpolateProvider) {
$interpolateProvider.startSymbol('[[');
$interpolateProvider.endSymbol(']]');
});

myApp.controller("MyController", ["$scope", function($scope) {
$scope.myName = "Sandeep Kumar Patel";
}]);
</script>
</body>

</html>
The output of the above code has been embedded in below JSBIN link.AngularJS $interpolateProvider Example
 •  0 comments  •  flag
Share on Twitter
Published on November 16, 2014 07:04
No comments have been added yet.