knockout.js - Rendering knockout templates with JQM -


i have piece of code:

 <!--ko with: passengerdocs-->                 <div data-bind="foreach: flights()">      <div>       <span data-bind="text: carrier + number"></span>       <span data-bind="text: depraturedatetime"></span>       <span data-bind="text: route"></span>      </div>     </div> <!-- /ko --> 

when use combined jquery mobile, rendered html is:

<div data-bind="foreach: flights()"></div> 

while without jqm reference full above templated html.

any idea?

here's jsfiddle best interpretation of you're trying do: http://jsfiddle.net/nuakf/2/

<!--ko with: passengerdocs-->      <button data-bind="click: fillflights">fill flights</button> <div data-bind="foreach: flights">  <div>   <span data-bind="text: carrier() + number()"></span> -    <span data-bind="text: departuredatetime"></span> -    <span data-bind="text: route"></span>  </div> </div> <!-- /ko --> 

some thoughts:

  1. when using foreach binding, don't need accessor () on binding (so foreach: flights() should foreach: flights),
  2. when using logic in binding, do. meaning data-bind="text: carrier + number" should data-bind="text: carrier() + number()" (assuming carrier , number observables , not standard properties)
  3. you don't seem have in here specific jquery mobile, it's not clear error receiving because of it, should use console view them, clarify issue.

if can clarify problem, can make answer more specific problem.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -