Meteor: Changing a subtemplate without changing parent template

雨燕双飞 提交于 2020-01-03 04:23:08

问题


If I have the following template structure

 <template name="A">
            {{> B}}
            {{> C}}
    </template>

How can I have C update when it changes without having Template A re-render?

I've tried {{#isolate}}{{> C}}{{/isolate}} but this doesn't work and using a constant region isn't quite right either as this isn't a constant region.


回答1:


As of Meteor 0.7.0.1, re-rendering a sub-template causes the parent to re-render but not sibling templates. Isolate works the same way.

I put together a simple example of this that you can play with here:

https://github.com/alanning/meteor-subtemplate-isolate-test

Keep in mind that this behavior may change with the upcoming release of Meteor UI in preparation for Meteor 1.0.



来源:https://stackoverflow.com/questions/16005848/meteor-changing-a-subtemplate-without-changing-parent-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!