Search code examples
htmljquery-mobileknockout.jsmobile-browser

jQM Knockout.js containerless control flow syntax


I'm using jqm 2.3 and knockout 2.2.1. This is the code:

<!-- ko foreach: items() -->
...some code...
<!-- /ko -->

If I use Wi-Fi connection on my android smartphone, It's all ok. Instead if I use mobile connection, return error on knockout binding where some internal elements at items are not defined.

Somebody help me?


Solution

  • I think that is a problem of Android browsers that doesn't parse comment if connection slow.

    I have rounded the problem whith a component knockout: knockout-repeat.js

    <ul data-role="listview">
        <li data-bind="repeat: { foreach: people, item: '$item' }" data-repeat-bind="text: $item().firstName">
        </li>
    </ul>
    

    This is the result: http://jsfiddle.net/uUX9f/3/