からのオブジェクトの配列は、そこに私のAirTableService.js
(function() {
"use strict";
var AirTableService = function ($http, $q) {
var AirTableMethods = {
getMyRounds: function(AirTable_secret){
var deferObject_myRounds;
var myRounds_promise = $http.get('https://api.airtable.com/v0/XXXXXXX/Rounds?view=Main%20View&maxRecords=10&callback=JSON_CALLBACK', {
headers : {
'Authorization' : AirTable_secret.apikey,
'Content-Type' : 'application/json'
}
});
deferObject_myRounds = deferObject_myRounds || $q.defer();
myRounds_promise.then(function(data){
deferObject_myRounds.resolve(data);
});
return deferObject_myRounds.promise;
}
};
return AirTableMethods;
};
AirTableService.$inject = ['$http', '$q'];
angular.module('appGolf')
.service('AirTableService', AirTableService);
}());
です。私はパラメータview
とmaxRecords
を渡しています。私はそれは私が
、それは私に、このエラーを与えるには動作しません
https://api.airtable.com/v0/XXXXXXX/Rounds?view=Main%20View&maxRecords=10&sort=[{field:'RoundID',direction:'desc'}]&callback=JSON_CALLBACK
と明確に変更し、私はsort
を渡すことができ ドキュメント状態、
sort
はarray of objects
なので、私はこれをどのように渡しているのか分かりません。
私の質問は、どうすればAngularJS
でですか?
ありがとうございます。
[AngularJS '$ httpサービス]を使用して[GETリクエストで配列を送信](http://stackoverflow.com/questions/19957858/send-array-via-get-request-with-angularjs-http-service)の可能な複製 –
例のように二重引用符を試してみましたか? – DrewJordan
'$ http'はすでに約束を返しています。 '$ q'を使う必要はありません。 – Kyle