gwendall/way.js

null appearing in text fields

Opened this issue · 0 comments

Ataye commented

I have some props in my object that are string (in the json text string) but type being reported as object. and contain null values. When bound to a textbox the word 'null' appears. Shouldn't it handle this and instead use an empty string when binding with textboxes?

I got around this by cleaning up the object prior to loading it into way.js using (jquery):

for (var property in obj) {
if (obj.hasOwnProperty(property) && $.isEmptyObject(obj[property]))
   obj[property] = '';
}
way.set("scope", obj);

I'm coming from angular data-binding and wanted a lightweight data-binding solution for my non-angular projects and this is exactly what i needed. Great work!