I have created one html file in which angular js code has been located and another backend file is there. Url is working properly. but i am not able to use {{ }} in html. What is the reason for that? And when i am getting response from backend file is always none. But data is passing correctly in request header.
-
This is impossible to address. If you are using angular.js I recommend taking a look at django-rest-framework.Alvaro– Alvaro2015-02-02 13:51:33 +00:00Commented Feb 2, 2015 at 13:51
-
check this questionbformet– bformet2015-02-02 13:54:30 +00:00Commented Feb 2, 2015 at 13:54
-
I am not able to print values in ng-repeat block using {{ }}Krunal Sevak– Krunal Sevak2015-02-02 14:14:23 +00:00Commented Feb 2, 2015 at 14:14
-
I am also not able to get request back from views.py file. whenever i am alerting result of success is always noneKrunal Sevak– Krunal Sevak2015-02-02 14:15:26 +00:00Commented Feb 2, 2015 at 14:15
Add a comment
|
2 Answers
I would recommend to use Angular JS and Django with the Django REST framework. That way you have the backend and frontend separated. Here are some links to get you started:
Getting Started with Django Rest Framework and AngularJS: http://blog.kevinastone.com/getting-started-with-django-rest-framework-and-angularjs.html
Comments
This is because the AngularJS renderer and Django template engine share the same token for variable substitution in templates.
Use verbatim block to stop the template from Django template rendering.
4 Comments
Krunal Sevak
I have tried that still i am not getting output..
Riccardo
post your code, otherwise it's hard to understand
Krunal Sevak
<script src= "ajax.googleapis.com/ajax/libs/angularjs/1.2.26/…> <body> <div ng-app="" ng-controller="customersController"> <ul> <li ng-repeat="x in names"> {{ x.Name + ', ' + x.Country }} </li> </ul> </div> <script> function customersController($scope,$http) { $http.get("/angu_json/") .success(function(response) {$scope.names = response;}); } </script>
Krunal Sevak
And I have send json like {"stat": "true", "result": [{"name": "krunal", "id": 2}, {"name": "umang", "id": 3}]}