我正在尝试使用query-params为EmberJS中的日志列表界面开发搜索功能,但我无法让它工作。 基于此示例:http://emberjs.jsbin.com/ucanam/2708/edit我有:
App.DashboardLogsRoute = Ember.Route.extend({
queryParams: {
search: {
refreshModel: true
}
},
model: function(params){
console.log(params.search)
if(params.search && params.search != '')
return Ember.$.getJSON("/logs.json?search=" + params.search);
else
return Ember.$.getJSON("/logs.json");
},
actions: {
queryParamsDidChange: function(){
this.refresh();
}
}
});
App.DashboardLogsController = Ember.ArrayController.extend({
queryParams: ["search"],
search: null,
searchText: Ember.computed.oneWay("search"),
actions: {
search: function(){
this.set("search", this.get("searchText"));
console.log(this.get("search"))
}
}
});
console.log(this.get(“search”))显示我在输入中提交的更改但是URL都没有更新,模型都没有刷新......我错过了什么?