开发者

Using a template in multiple data-bindings

I'm having trouble using a template bound multiple times.

For instance this is fine:

<ul data-bind="template: { name: 'searchField-template', 
                           foreach: Title, 
                           templateOptions: { checkedField: 'TitleSelected' } }">
</ul>

However, if I add the following:

<ul data-bind="template: { name: 'searchField-template', 
                           foreach: Manager, 
                           templateOptions: { checkedField: 'ManagerSelected' } }">
</ul>

Then I get an error:

Uncaught TypeError: Cannot read property '_destroy' of undefined" at line 1894

Am I doing something wrong? Is there an altern开发者_StackOverflowate way, or is this a bug in knockout.js?

I'm using version 1.2.1.


Knockout does not have a problem using a template multiple times or even using a template recursively.

Here is a sample: http://jsfiddle.net/rniemeyer/aqBQs/

There is likely something else going on in your scenario. If you can reproduce it based on that sample, then I would be happy to help troubleshoot.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜