AngularJS-Twig conflict with double curly braces

Meliborn picture Meliborn · Dec 2, 2012 · Viewed 83.8k times · Source

As you know, both angular and twig has common control construction - double curly braces. How can I change default value of Angular?

I know that I can do it in Twig, but in some projects I can't, only JS.

Answer

abhaga picture abhaga · Dec 2, 2012

You can change the start and end interpolation tags using interpolateProvider service. One convenient place for this is at the module initialization time.

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

https://docs.angularjs.org/api/ng/provider/$interpolateProvider