Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Script at the bottom?

Tags:

knockout.js

I include my viewmodel script at the bottom of the page and have a problem. The matter is until applyBindings is called (which is also at the bottom) user can see the not binded page for a second where naked template is displayed. One of the solutions is to place scripts at the top and wrap applyBindings in $() or "document ready". But I really refuse to accept there is no way to solve the problem and keep scripts at the bottom.

like image 706
Sergey Metlov Avatar asked Jan 23 '26 15:01

Sergey Metlov


1 Answers

I always use something like this:

<div data-bind="visible:true" style="display:none">
    ...
</div>
like image 122
pomber Avatar answered Jan 26 '26 23:01

pomber



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!