Skip to content Skip to sidebar Skip to footer

Knockout.js -- Understanding Foreach And With

I've been going through the learn.knockout.js tutorials and been experimenting. Can someone explain why this works [Tutorial: Single page applications, Step 2] (using with: chosen

Solution 1:

Because you are not actually accessing the property you want with the way it is written. In the model chosenFolderData is an observable and must be called like a method to retrieve the value. To provide the functionality without using with (and I suggest not using with where high performance is necessary because of the overhead)...

<tbody data-bind="foreach: chosenFolderData().mails">

Post a Comment for "Knockout.js -- Understanding Foreach And With"