I am returning a template with some data from Flask server to angularJS.
jsonObject - {"name" : "alan"}
Server
@app.route("/hello")
return render_template("hello.html", result=jsonObject)
Client
maincontroller.js
var app=angular.module('myApp',[]);
app.controller("MainController", function($scope,$http){
var done=function(resp){
//how to get the response data from server
$scope.list=?
};
var fail=function(err){
};
$http.get('http://127.0.0.1:8083/hello')
.then(done,fail);
});
hello.html
<body>
Hello {{list.name}}!!
</body>
How to get the response object in the controller with render_template in the server?