AngularJs code (not) accessing Python Class method

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



AngularJs code (not) accessing Python Class method



I am trying to make my angular code call Python class method. But $http.post and $http.get can not find the right class, and I cannot think of a way since this wat it worked with C#.



Here's my angular code


$scope.init = function ()
//Take the list of applications from database
$http.get('/MainHandler/loadlist').then(
function successCallback(response)
$scope.results = response.data;
if ($scope.results == 1)
$scope.list = $scope.results;
else
$window.alert("Cannot load the apps list.")
,
function errorCallback(response)
$window.alert("Error: can not fetch data from server.")
);
;



And python code (crud.py) is as following


class MainHandler(tornado.web.RequestHandler):
def loadlist(self):
cursor = mongo_session[app_collection].find()
docs = yield cursor.to_list()
return docs



I debugged from the browser, and it resembles the angular code, its fine. But the $http.get(...) line cannot find the method I am trying to call.
How should i call the class method? Is there a way that I should be following?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS