kirbysayshi / vash

Vash, the 60 billion double-dollar template-maker. Razor syntax, for JavaScript templates
Other
524 stars 60 forks source link

How to make multiple includes for the same component work? #115

Closed nishch closed 7 years ago

nishch commented 7 years ago

I have noticed, if I try to include the same component multiple times within a block, it only gets rendered once. I am not sure if this is by design or a bug. If it's be design, how can I make something like following work.

I have pagination component, an example :

@html.block('pagination', function(model){
    <ul class="pagination pagination-sm pull-right">
        <li><a href="#">1</a></li>
        <li class="active"><a href="#">2</a></li>
        <li><a href="#">3</a></li>
        <li><a href="#">4</a></li>
        <li><a href="#">5</a></li>
    </ul>
})

Now I want to put it in a page twice, at the top and bottom of a page and to do that I am using, following snippet twice. Surprisingly it gets rendered only once. Please help

@html.include('pagination', model)
kirbysayshi commented 7 years ago

It's been a while since I checked, but I believe .block overrides the content each time it is called. You're probably looking for @html.append instead of block?

kirbysayshi commented 7 years ago

Please reopen if this doesn't help!