Skip to content

Instantly share code, notes, and snippets.

@nathanpalmer
Created July 31, 2011 02:07
Show Gist options
  • Save nathanpalmer/1116269 to your computer and use it in GitHub Desktop.
Save nathanpalmer/1116269 to your computer and use it in GitHub Desktop.
var PersonCollection = Spine.Model.setup("Person", [
"firstName",
"lastName"
]);
PersonCollection.include({
fullName: function() {
return this.firstName + " " + this.lastName;
}
});
var PersonController = Spine.Controller.create({
bindings: {
"value input[name=firstName]": "firstName",
"value input[name=lastName]": "lastName",
"text #fullName": "fullName"
},
init: function() {
this.initializeBindings(this.model);
}
});
PersonController.include(DataBind);
var Person = PersonCollection.create({ firstName: "", lastName: "" });
var Controller = PersonController.init({ el: 'body', model: Person });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment