Rendering one mustache partial multiple times with different data

后端 未结 2 1943
耶瑟儿~
耶瑟儿~ 2021-02-08 23:47

I have two objects that I want to render side by side. There is never a case where I will want to render more, or less than two. My model is setup like so:

{
  o         


        
2条回答
  •  不思量自难忘°
    2021-02-09 00:36

    The syntax I think you are looking for is not {{>objPartial obj1}}, but rather it should be

    {{#obj1}}
    {{>objPartial}}
    {{/obj1}}
    

    The syntax for {{#}} isn't only for arrays - for non array objects the object becomes part of the current scope.

    I've forked maxbeatty's example and modified it to show this syntax:

    
    
    
    

    Link to jsfiddle: http://jsfiddle.net/YW5zF/3/

提交回复
热议问题