formatting - How to format the values of a model in Marionette Backbone View before rendering? -


if implement onbeforerender method no way access model values in order format them temporarily

ideally want format values before rendering without changing model values of course!

how it?

by checking link: http://derickbailey.github.io/backbone.marionette/docs/backbone.marionette.html

you find serializedata being used before rendering template

so overriding it, below can format object values way want before rendering

serializedata():any {         var obj = super.serializedata();          obj.totalenergy = math.round(obj.totalenergy).tofixed(0)          return obj     } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -