Reputation: 1744
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?
when submitting the view's textfield?
Or what is the best and most logic way to implement search forms in ember applications?
Upvotes: 0
Views: 65
Reputation: 19128
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.
Here is a jsfiddle with the demo
Upvotes: 1