简体   繁体   中英

Pass variables in AngularJS $http GET?

Is it possible to pass a variable to a server in AngularJS $http service GET? I want to be able to "GET" a certain number of items from the server, and in the request I want to specify the number.

Thanks.

Yes, just add it onto the url:

$http.get("/users?items=15").success(function(data) {
    $scope.users = data;
});

Then in your python handler for /users get the value of items using self.request.get("items")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM