7
If this is a template that’s rendered by Django first, than the Django Template engine will replace all {{ something }}
with whatever it can resolve that to.
This means that by the time the code gets to the browser and AngularJS loads it up, there aren’t any curly braces left in the code to resolve, just (probably) blanks.
In order to go around this, AngularJS allows you to change what the characters for template markup are, via an interpolationProvider
. Here’s the docs link. I usually use [[ ]]
.
Here’s the example from the link above and how to integrate it in your app:
var customInterpolationApp = angular.module('customInterpolationApp', []);
customInterpolationApp.config(function($interpolateProvider) {
$interpolateProvider.startSymbol('//');
$interpolateProvider.endSymbol('//');
});
customInterpolationApp.controller('DemoController', function() {
this.label = "This binding is brought you by // interpolation symbols.";
});
Source:stackexchange.com