且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

KO找不到带ID的模板

更新时间:2023-11-18 22:38:58

简答:你不能目前在
但是, nemesv 指出,如果你将你的命名模板放在Durandal之外,ko就能找到它们。例如,< div id =applicationHost>< / div> 元素之外的任何地方。

The short answer: You can't currently use Knockout templates inside of Durandal. However, as nemesv pointed out, if you put your named template outside of Durandal, ko is able to find them. For example, anywhere outside of the <div id="applicationHost"></div> element.

其他解决方法是使用Durandal的撰写功能,或者只是将模板内联为匿名。

The other workarounds are to either use Durandal's compose functionality, or just inline the templates as anonymous.

在不久的将来可能会支持Knockout模板。

Knockout templates will probably be supported in the near future.

我终于在Durandal google小组上挖出了这些答案,

I finally dug these answers up on the Durandal google group,

  • Mixing knockout templates with durandal compose
  • knockout can't find templates inside of views