librelist archives

« back to archive

nested names

nested names

From:
Seven Du
Date:
2010-10-16 @ 04:33
Hello, I wonder how to do access the parent object with the same name
in a nested mustache:

one user has many dogs:

{{#user}}
   {{name}}

   {{#dogs}}
       {{name}}  <-  the dog's name

       here I want to show the user name, say {{user.name}} or
{{parent.name}} or {{user::name}}

   {{/dogs}}
{{/users


Thanks.

-- 
Blog: http://www.dujinfang.com
Proj:  http://www.freeswitch.org.cn

Re: [mustache] nested names

From:
Chris Wanstrath
Date:
2010-10-18 @ 14:27
On Sat, Oct 16, 2010 at 1:33 AM, Seven Du <dujinfang@gmail.com> wrote:
> Hello, I wonder how to do access the parent object with the same name
> in a nested mustache:

Like this:

https://gist.github.com/3c91441597ac650146b9

But, there should probably be a better way.

Re: [mustache] nested names

From:
Seven Du
Date:
2010-10-18 @ 15:50
Good idea. Thanks.

On Mon, Oct 18, 2010 at 10:27 PM, Chris Wanstrath <chris@ozmm.org> wrote:
> On Sat, Oct 16, 2010 at 1:33 AM, Seven Du <dujinfang@gmail.com> wrote:
>> Hello, I wonder how to do access the parent object with the same name
>> in a nested mustache:
>
> Like this:
>
> https://gist.github.com/3c91441597ac650146b9
>
> But, there should probably be a better way.
>



-- 
Blog: http://www.dujinfang.com
Proj:  http://www.freeswitch.org.cn