문제

I used a template in my application like:

<section class="view-list" data-bind="template: { name: viewTemplate, foreach: locaFacts }">

but in some cases, mostly on the first load the output html is lots of Loading... instead of real templates.

It seems that knockout shows Loading... until the view model gets ready. As I cached the results, the second call will show the templates correctly.

Why the first call to template shows Loading... instead of template itself?

EDIT:

I use knockout external templates and infuser.

도움이 되었습니까?

해결책 2

I changed my template engine and used Durandal's compose feature. Now everything is OK.

다른 팁

I was able to correct this by setting ajax option async to false by modifying the template binding like so:

<div class="pagination" data-bind="template: { name: 'pager', data: pager, ajax: { async: false } }">
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top