Closed trueqbit closed 7 years ago
Thanks for finding this! Yes, it is a bug.
The fix is very simple. Change line https://github.com/BorisMoore/jsviews/blob/master/jsviews.js#L3620 to
sourceValue = linkFn(source, view, $sub);
I'll include the fix in the next update.
Thanks! The fix is working great, both for data-linked tags and elements.
Fixed with commit 84
I am trying to link a list of items to table-rows. There are two lists for different purposes, but with the exact same data structure, which is why I want to encapsulate markup for an item into an external template.
The list might be absent from the data, that's why I am using an onError handler. This is even more necessary because the list in turn is wrapped inside another optional container [note that the json is actually produced by x2js from xml].
Here is some simplified code to show what I am talking about:
The actual problem that occurs is that jsviews outputs 'fallback' instead of rendering the template.
Fixing the data structure, such that the 'persons' container is always present, is a possibility, but I believe this to be a bug in jsviews, because either removing 'onError' or the '~prefix' parameter makes things work again.
Here is a fiddle showcasing the issue.