Skip to content

Instantly share code, notes, and snippets.

@tauren
Created March 22, 2011 22:20
Show Gist options
  • Save tauren/882215 to your computer and use it in GitHub Desktop.
Save tauren/882215 to your computer and use it in GitHub Desktop.
Handling different URLs with backbone.js
var FindUserCollection = Backbone.Collection.extend({
model: User,
baseUrl: "/api/v2/users",
url: function() {
return this.baseUrl + '?' + $.param({
search: this.search,
limit: this.limit
});
}
search: null,
limit: null
});
var UserCollection = Backbone.Collection.extend({
model: User,
baseUrl: "/api/v2/users",
url: function() {
return this.baseUrl;
}
search: null,
limit: null
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment