我正在使用 Parse REST API 使用 Angular2 获取一些数据,一切正常,但我需要按降序获取数据,返回 Parse 文档,应该执行以下操作:
curl -X GET \
-H "X-Parse-Application-Id: appID" \
-H "X-Parse-REST-API-Key: keyID" \
-G \
--data-urlencode 'order=-score' \
https://api.parse.com/1/classes/GameScore
我想在我的Angular2代码中模拟那个cURL,我主要需要的是实现:data-urlencode
目前,这是我的 Angular2 代码:
this.http.get('https://example.com/classes/GameScore').subscribe(data => {
this.res = data.json().results;
});