We have the same problem. We use knockout in conjunction with jQuery templates (which we will replace with jsRender soon). JQuery-File-Upload (blueImp) upload / download templates are Django templates . I treat these templates as templates in the application. We encapsulated the functionality of loading jQuery files into a knockout custom linker:
ko.bindingHandlers.fileupload = { update: function (element, valueAccessor) { var options = valueAccessor() || {};
which we use like this:
<div id="fileuploadcontrol" data-bind="fileupload: { url: [UPLOAD URL], maxFileSize: [MAX FILE SIZE], acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, completed: function (e, data) { $.each(data.files, function (index, file) { //Stuff to do with uploaded files } } }"> <div class="fileupload-buttonbar"> //STUFF //STUFF </div> </div>
source share