Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop KnockoutJS from using jQuery.tmpl

I'm adding Knockout to specific section of a large application. Other parts make use of jQuery Templates (and it's embeded in a base JS file), so it's on the global jQuery object and I cannot remove it.

I'm running into the following error message when I use a foreach binding in a template:

This template engine does not support the 'foreach' binding within its templates 

It seems this is a problem when using the jQuery Template engine with Knockout. Is there any way to make Knockout use its default template engine rather than jQuery Templates?

like image 329
Mike Davis Avatar asked Dec 12 '22 17:12

Mike Davis


1 Answers

You can use ko.setTemplateEngine(new ko.nativeTemplateEngine()); before calling ko.applyBindings.

like image 87
RP Niemeyer Avatar answered Feb 20 '23 21:02

RP Niemeyer