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, |
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 child = new Backbone.Model({name: "child"}); | |
var parent = new Backbone.Model({name: "parent", child: child}); | |
var json = parent.toJson() | |
This should return: | |
{ | |
name: "parent", | |
child: { | |
name: "child" | |
} |
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 user = new User({ | |
id: 1, | |
username: "bob", | |
address: { | |
id: 1, | |
street: "232 SW Main" | |
city: "", | |
state: "", | |
zip: "" | |
} |
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
/* | |
* REST endpoint: /projects | |
*/ | |
var projects = [ | |
{ | |
"id": 2, | |
"name": "Project 1", | |
"members": [ | |
{"id": 1, "name": "Tom", "phone": "555-5555"}, | |
{"id": 2, "name": "Sue", "phone": "555-5555"} |
NewerOlder