Question

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?

Was it helpful?

Solution 2

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/

OTHER TIPS

This sounds like a timing issue where either your DOM or your viewmodel hasn't been built before you apply your bindings; pretty much the only difference between a wifi and a mobile connection is going to be the speed and order of various components coming in.

Make sure that your script doesn't start running until the DOM is complete (either put it/the reference to it at the end of your <body> or put it in a jQuery DOM-ready handler), and that it doesn't call applyBindings before the viewmodel has built (make sure the call to applyBindings occurs at the end of the function that creates your VM).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top