query-params-new標誌設置爲true。Ember查詢參數不在請求中發送參數
使用最新的餘燼和餘燼數據。燼:1.6.0-beta.1 + canary.b5b90241 ember.js和餘燼數據:1.0.0-beta.7 + canary.b45e23ba
應用適配器被設置爲這樣:
export default DS.RESTAdapter.extend({
host: 'http://example.com',
namespace: 'api/v2',
headers: {
"ClientId": "a-key",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "X-Requested-With"
}
});
的位置的路線是這樣的:
export default Ember.Route.extend({
model: function(params){
return this.store.find('restaurant');
}
});
的位置控制器看起來像這樣
export default Ember.ArrayController.extend({
queryParams: ['lat', 'lon', 'limit'],
lat: null,
lon: null,
limit: null,
});
導航到該網址http://example.com/locations?lat=47.620508&limit=22&lon=-122.349174
Ember數據發送http://example.com/locations
作爲請求。
我必須錯過什麼?
感謝我使用灰燼了答案:1.6.0-beta.1 + canary.b5b90241 ember.js和灰燼數據:1.0.0 -beta.7 + canary.b45e23ba和我的控制器看起來像這樣。我會用控制器更新這個問題。 – kiwiupover
@kiwiupover我更新了我的答案,並根據您更新的問題提出了另一個建議。我決定留下最初的建議以防其他人遇到此問題。 –
謝謝你beerlington!問題是我沒有解析路線中的參數。此外,該路線可以讀取'this this.store.find('locations',params)'。 – kiwiupover