Удалить вставленный шаблон в метеор 0.8.0

Я вставляю шаблоны, используя UI.render () и UI.insert ().

Когда я пытался удалить шаблон, который я вставил, он, похоже, остался в памяти, а уничтоженный метод не вызывается.

Согласно документации, он должен очистить свойство, если я использую jquery для удаления элемента.

Я тестирую его, используя следующий код:

test.html:

<head>
  <title>removeTest</title>
    <style>
        #content {
            height: 500px;
            width: 500px;
            background-color: gray;
        }
    </style>
</head>    

<body><div id="content"></div></body>    

<template name="foo"><div id="{{id}}">Foo</div></template>

test.js:

if (Meteor.isClient) {
    UI.body.events({
        "click": function(event) {
            var instance = UI.renderWithData(Template.foo, { });
            UI.insert(instance, $("#content")[0]);
        }
    });    

    Template.foo.created = function() {
        this.data.id = "handle";
        var self = this;
        this.x = setInterval(function() { console.log("running...") }, 1000);
        setTimeout(function() { $("#handle").remove() }, 1000);
    };    

    Template.foo.destroyed = function() {
        // never called.
        clearTimeout(this.x);
    };
}

Что я сделал не так?

Благодарю.

Ответы на вопрос(5)

Ваш ответ на вопрос