for some reason I cannot get a foreach binding to work with a $data object in it, I have posted the code on JSfiddle
the weird thing for me is that
<div data-bind="template: { name: 'input-template', foreach: $root.geometries['Kubus'].invoer }"></div>
works, and that $data is 'Kubus'
but that
<div data-bind="template: { name: 'input-template', foreach: $root.geometries[$data].invoer }"></div>
gives a javascript error message:
Unable to parse bindings. Message: TypeError: $root.geometries[$data] is undefined; Bindings value: template: { name: 'input-template', foreach: $root.geometries[$data].invoer }
- can you explain why this happens?
- can you tell me how I should do it so the error doesn't show?
- are there ways to do what I'm trying to do with more efficient code?