Why iron-router does not render carousel?

故事扮演 提交于 2019-12-11 03:06:32

问题


it works perfectly when I make it like this

<body>
{{> carousel}}
</body>
<Template name="carousel">
....here the code of carousel...
</Template>

but when I use iron-router to render the Template; it does not render carousel

<body>
{{rendreRouter}}
</body>
<Template name="carousel">
    ....here the code of carousel...
 </Template>

Router.map(function () {
  this.route('carousel',{
    path: '/'
  });
});

回答1:


I'm coming to the conclusion that the documentation you're reading is not in sync with the code base. In fact, it looks like the feature is gone.

In my own exploration of the topic, I have an alternate solution at that may work for you at the bottom of this post.




回答2:


Init your carousel in template.rendered hook, for example my template is named main_slider.

Template.main_slider.rendered = function() {
    // init carousel here
};


来源:https://stackoverflow.com/questions/24328368/why-iron-router-does-not-render-carousel

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