Created
March 22, 2012 11:37
-
-
Save chriskilding/2157840 to your computer and use it in GitHub Desktop.
Making new instance of model with backbone-forms (question)
This file contains 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
class App.Views.OrganizationsIndex extends Backbone.View | |
template: JST['organizations/index'] | |
initialize: -> | |
# need to ensure collection is loaded | |
# before the template renders | |
# don't forget the 'this' context binding | |
@collection.on('reset', @render, this) | |
render: -> | |
# the toJSON bit is just to make the Handlebars template work with the collection | |
$(@el).html(@template(organizations: @collection.toJSON())) | |
# append 'new organization' form | |
form = new Backbone.Form({ | |
model: ?????? | |
}).render() | |
$(@el).append(form.el) | |
# for method chaining | |
this |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For powmedia/backbone-forms#48