Open thalisvilela opened 12 years ago
And also with some custom attributes like:
obj = $$({ model:{}, customAttribute:{ subAttrSet:{ key:value } } })
As a workaround you could flatten the object into the model:
var test = $$({
attr : {first:'abc', second:'def', third:'this is not used'}
}, '<div>The first: "<span data-bind="first"/>" and the second: "<span data-bind="second"/>"</div>', {
'create' : function() {
var attr = this.model.get('attr');
//attr is nulled to free unused elements of the object
this.model.set({first:attr.first, second:attr.second, attr:null});
}
});
This will output: The first: "abc" and the second: "def"
My problem is:
With this:
obj = $$({ model:{ attr:{ subAttr:"some stuff" } }, view:{ format:"someElement data-bind="attr.subAttr" " })
output this: someElement> some stuff </someElement