backbone.js - How to test for undefined Object properties in handlebar.js -


i have collection models property called start_time in seconds (0-60..), undefined if no start_time set.

i have troubles test if property 0 or null/undefined, since handlebar #if converts 0

if fetching data use collection.parse set new field on model test in view.

yourcollection = backbone.collection.extend({   url: "/api/foo",   parse: function(res) {             return _.map(res, function(source) {           obj = _.clone(source);       obj.no_start = !obj.hasownproperty('start_time');       return obj;     });   } }); 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -