Skip to content

Instantly share code, notes, and snippets.

@samdelagarza
Created March 17, 2011 22:40
Show Gist options
  • Save samdelagarza/875279 to your computer and use it in GitHub Desktop.
Save samdelagarza/875279 to your computer and use it in GitHub Desktop.
search.View = Backbone.View.extend({
events: {
"keydown input": "search"
},
search: function(event) {
this.trigger('search',"myq");
}
});
filter.FavoriteFilterController = Backbone.Controller.extend({
routes: {
"search/:query": "search"
},
search: function(query) {
console.log(query);
},
initialize: function(){
_.bind('search',this);
}
});
@devth
Copy link

devth commented Mar 17, 2011

        initialize: function(){
            this._searchView = new search.View();
            _.bindAll(this, 'search'); // Set scope of "this" inside search handler
            this._searchView.bind('search', this.search);
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment