0
我有一個函數使用$ http發佈參數。我不明白的是filters
param包含一個數組。但是,服務器將此數組解釋爲數組中每個項的鍵/值對。爲什麼?這是一個AngularJS還是服務器端的問題?
var updateCandidates = function (slot) {
console.log(slot.filters)
$http({method: 'POST', url: '/api/slot_candidates', params: {
type: slot.type,
start_date: slot.start_date,
end_date: slot.end_date,
filters: slot.filters
}}).success(function (response) {
return response
}).error(function (response) {
$rootScope.modalAlert('error', 'Something happened', true)
})
}
# request.params. Note the duplicate 'filters' key
NestedMultiDict([(u'end_date', u'2014-12-30T14:00:00'), (u'filters', u'{"operator":"contains","group":"program","type":"unicode","name":"title","query":"joan of arc"}'), (u'filters', u'{"operator":"contains","group":"program","type":"unicode","name":"aspect_ratio","query":"16"}'), (u'start_date', u'2014-08-25T00:00:00'), (u'type', u'Program')])