[英]Ember.js change router statement within view
Suppose I have a view: 假设我有一个看法:
Cellar.SearchTextField = Ember.TextField.extend({
insertNewline: function(){
// Cellar.SearchController.loadResults();
}
});
And I have a route: 我有一条路线:
Cellar.Router.map(function() {
this.route('search', { path: '/search'});
});
How can I change app url to host/#/search?
如何将应用程序网址更改为
host/#/search?
when submitting the view's textfield? 提交视图的文本字段时? Or what is the best and most logic way to implement search forms in ember applications?
还是在余烬应用程序中实现搜索表单的最佳,最逻辑的方法是什么?
I get this working using: 我使用以下方法进行工作:
App.SearchField = Ember.TextField.extend({
insertNewline: function() {
this.get('controller').transitionToRoute('search', this.get('value'));
}
});
This will transition to search route, so you can load and filter the data on model
hook. 这将过渡到搜索路线,因此您可以在
model
挂钩上加载和过滤数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.