Hello! I'm trying to make a SPA application on Django + Angular, set up a REST API and as soon as I got to the public part I came across a problem: Angular refuses to load data from the controller into the template. I simplified the client application to the maximum, but this did not solve the problems:
app.js
var app = angular.module('uniApp', []); app.controller('uniController', function ($scope) { $scope.message = "some text"; });
index.html
<!DOCTYPE html> <html ng-app="uniApp"> <head> <meta charset="utf-8"> <title>UNI DIGIT</title> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.js"></script> </head> <body ng-controller="uniController"> <h1>{{ message }}</h1> {% load staticfiles %} <script src="{% static 'js/shared/angular-ui-router.min.js' %}"></script> <script type="text/javascript" src="//cdn.jsdelivr.net/restangular/latest/restangular.js"></script> <script type="text/javascript" src="{% static 'js/app.js' %}"></script> </body> </html>
File structure:
main/ --static/ --js/ --app.js --templates/ --main/ --index.html
When I try to do the same without Django, everything works, maybe it is in him. But after all, Django simply gives the html page and the necessary scripts ...