[Fixed]-Angular JS installed but not loading, in Django app

1๐Ÿ‘

โœ…

If you have never worked with Django + AngularJS before, I will assume that you are trying to use {{ variable }} in your template.

That syntax will try to render a Django variable from the view (passed by context_data).

You will need to change the AngularJS tags:

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

EDIT

Example:

var MyApp = angular.module('MyApp', []);

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

After you do this, when you want to call a variable or angular expression in your template you will use {[{angular_variable}]}, and when you want to call a Django variable you will use {{django_variable}}

Also you can see this answer and the AngularJS documentation for this topic

๐Ÿ‘คGocht

Leave a comment