Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'as' parameter not compatible to knockout-v3.5 behaviour, or not implemented? #52

Open
jensb opened this issue Oct 30, 2019 · 1 comment

Comments

@jensb
Copy link

jensb commented Oct 30, 2019

We are using large nested foreach loops in KO templates with 'as', i.e.

<div data-bind="foreach: { data: data, as: 'mydata' }">
    <div data-bind="foreach: { data: data2, as: 'mydata2' }">
         ....
     </div>
 </div>

to be able to refer to parent objects in a simpler way than using $parent and $parents[n].
However, this does not seem to work correctly with Knockout. It executes massively faster (10x and more), but when just replacing foreach with fastForEach in the above example, the loops still get executed (I can see this in the devel console because inside the loop we call custom JS functions) but there is no HTML output, nothing is rendered.

Is this a bug in fastForEach, a missing feature/option (is 'as' implemented at all as a parameter?) or am I missing something obvious?

@jensb
Copy link
Author

jensb commented Nov 20, 2019

I created a pull request #53
It works on my end, but I'm not sure if all tests are correct and pass.
Please check and integrate if it works.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant