Angular test $interpolate

by Julien Roche

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.9/angular.js"></script>
<body>
  <h1>Interpolate examples</h1>
  <section ng-controller="MyController">
    <div>{{ case1 }}</div>
  </section>
</body>

JavaScript

angular
	.module('myApp', [])
  .controller('MyController', function ($scope, $interpolate) {
  	$scope.case1 = $interpolate('https://www.example.com/en/product/{{productId}}')({
      'productId': 'myProductCode',
      'languageCode': 'EN'
    });
  });
  
  angular.bootstrap(document.body, ['myApp']);