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:
- when using foreach binding, don't need accessor () on binding (so foreach: flights() should foreach: flights),
- 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)
- 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
Post a Comment