Why iron-router does not render carousel?

2019-07-20 12:58发布

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: '/'
  });
});

2条回答
Juvenile、少年°
2楼-- · 2019-07-20 13:28

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

Template.main_slider.rendered = function() {
    // init carousel here
};
查看更多
何必那么认真
3楼-- · 2019-07-20 13:48

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.

查看更多
登录 后发表回答