2015-06-01 27 views
0

我這樣寫。

$http({ 
    params: { 
      cql: "select * from Car where Brand in (?) and CreatedBy.obje ctId in (?) order by updateAt desc", 
      pvalues: [["1", "2"], ["test"]] 
     }, 
    method: "GET", 
    url : URL.CLOUD_QUERY 
}); 

但是,當我檢查鉻檢查器時它被轉換爲下面。

cql:select * from Car where Brand in (?) and CreatedBy.objectId in (?) order by updateAt desc 
pvalues:["1", "2"] 
pvalues:["test"] 

我不想得到兩個pvalues。我有一個workaroud來編寫像這樣的{pvalues {0:[],1:[]},但我不喜歡這種方式。

回答

1

將它作爲字符串傳遞並在服務器端將其轉換回數組對象。

$http({ 
    params: { 
      cql: "select * from Car where Brand in (?) and CreatedBy.obje ctId in (?) order by updateAt desc", 
      pvalues: JSON.stringify([["1", "2"], ["test"]]) 
     }, 
    method: "GET", 
    url : URL.CLOUD_QUERY 
}); 
+0

這是一個錯誤還是$ http有意這樣做? – poordeveloper

+1

這不是一個錯誤。這就是$ http應該通過任何數組輸入。 – ShankarSangoli