Is there a converter parameter for bindings in the Backbone.Modelbinding plugin for Backbone.js?

I recently took over a large Backbone.js project which uses the Backbone.Modelbinding plugin to provide data-binding between models and views, with direct reference to the model attribute names in a "data-bind" attribute in the html elements.

For non-form items, the data-binding is one-way, from the model to the view, but for form items, the user can change the form input so that it updates the model attribute that has been bound to that element, and vice versa -- the model can also update the contents of the form input.

I am in need of some kind of view helper that will display the information in a different format than the data it's bound to in the model, without affecting the model itself.

For instance, if an attribute in the model has a value that is the number 679, I may need the view to display it as $679.00, while having the model's version remain just the number 679.

In other similar libraries, there are easy ways to perform these conversions, in either direction ("converter parameters" in Backbone.Modelbinder, "computed observables" in Knockout.js, I think they're called Converters in Silverlight, etc.). There doesn't appear to be a way to do it using Backbone.Modelbinding, though. Does anyone know of a way?


This was the final feature that got half implemented before Backbone.ModelBinding was abandoned. If you can, I would recommend switching to Backbone.ModelBinder.

Recommend that you use backbone.modelbinder( ) + backbone-nested( ).Can easily achieve the two-way binding between nested models and views.

There is a demo, I do hope useful for you:

backbone.modelbinder can easily solve your problem,see here:

Need Your Help

How to set a background for all view controllers?

ios viewcontroller

I would like to give the user the option to select which background image they would like to have in the navigation controller. After the user selecting the background image, how can I embed or set...

namespace in clojure not evaluating. Error: Unable to resolve symbol: deftest in this context, compiling:(NO_SOURCE_PATH:1:1)

emacs clojure

Dumb newbie question here. I created a brand new lein project and I am trying to run the sample test in the "core_test.clj" file. I am using emacs and "nrepl-jack-in". But when I run "(run-all-test...