4 ms·
I've become a huge backbone.js fan over the last fews months. If your app uses a lot of large forms I'd definitely look at the backbone.modelbinding project: h
by jwarzech 15y ago
I've become a huge backbone.js fan over the last fews months. If your app uses a lot of large forms I'd definitely look at the backbone.modelbinding project: https://github.com/derickbailey/backbone.modelbinding https://github.com/derickbailey/backbone.modelbinding. Also a few days ago I released a plugin from one of my projects that adds data binding support for deeply nested relationships: https://github.com/jwarzech/backbone.modelbinding.nested https://github.com/jwarzech/backbone.modelbinding.nested
- stusmith1977 15y agoJust to present an alternative: I found for apps which don't use many forms the above plugins can be overkill. I used something like the following: https://gist.github.com/2049308 https://gist.github.com/2049308 ..to provide simple form-to-model and model-to-form conversions, with appropriate validation. Just decorate the form elements with data-bind="property" and away you go. (I'm using Bootstrap so the validation is tied heavily to that). (I'm certainly not trying to denigrate the above plugins - obviously different apps have different requirements and as pointed out, if you have many forms then the above plugins make much more sense. The fact that Backbone lets you make these decisions is for me a nice feature).
- jwarzech 15y agoNice and simple...I like it. Snippets like these are great to have in the arsenal. Sometimes I end up using the 'heavy' solutions for simple things (just cause I've used them before and its easy to snap in) when I could really get away with rolling a simple solution like you did there.