Created
March 22, 2011 22:20
-
-
Save tauren/882215 to your computer and use it in GitHub Desktop.
Handling different URLs with backbone.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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