django - Cannot show information from DRF page using AngularJS -
here codes i've written:
drf page [ http://localhost:8000/index/info/?format=json ]
[{"id": 1, "name": "michel", "city": "florida", "country": "united states"}, {"id": 2, "name": "shuvo", "city": "london", "country": "united kingdom"}] 2.html [this second attempt]
<!doctype html> <html> <script src="angular.min.js"></script> <script src="2.js"></script> <body> <div ng-app="myapp" ng-controller="myctrl"> <ul> <li ng-repeat="x in info"> {{ x.name + ', ' + x.country }} </li> </ul> </div> </body> </html> 2.js
var app = angular.module('myapp', []); app.controller('myctrl', function($scope, $http) { $http.get("http://localhost:8000/index/info/?format=json") .success(function(response) { $scope.info = response; }); }); my 2.html page shows nothing. it's blank. doing wrong? :(
since django , angular use same notation display variables, have use verbatim tags using {{}} angular tags. otherwise treated django tags.
Comments
Post a Comment