node.js - Dust.js using the same partial many times on the same page -
i have parent template receives following context:
{ users: [ { userid: "18288128", group: "user 1 group name", uservideos: [{ id: 1, name: "video1"}, { id: 2, name: "video2"}, { id: 3, name: "video3"}] }, { userid: "1232412", group: "user 2 group name", uservideos: [{ id: 4, name: "video93"}, { id: 5, name: "video384"}, { id: 6, name: "video483"}] }, { userid: "1231231", group: "user 3 group name", uservideos: [{ id: 7, name: "videoa"}, { id: 8, name: "videob"}, { id: 9, name: "videoc"}] } ] }
this parent template:
{#users} {! here want add partial video_list passing correct parameters (uniqueid, groupname , video list) !} {>video_list /} {/users}
this partial video_list:
uniqueid: {uniqueid}{~n} groupname: {groupname}{~n} <ul> {#videos} <li>{name}</li>{~n} {/videos} </ul>
how can call partial parent template e pass parameters uniqueid=userid, groupname=group , videos=uservideos (this list).
partials accept parameters, can this:
{>video_list uniqueid=userid groupname=group videos=uservideos/}
Comments
Post a Comment