BorisMoore / jsrender

A lightweight, powerful and highly extensible templating engine. In the browser or on Node.js, with or without jQuery.
http://www.jsviews.com
MIT License
2.68k stars 340 forks source link

How can the tag "{{for ...}}" render member that can't be used with dot notation? #246

Closed Ginhing closed 10 years ago

Ginhing commented 10 years ago

If I have a object:

{
    name: "Peter",
    member: {
        "foo.bar": "a dot here"
    }
}

and the template such as:

<ul>
  {{for members}}
      <li>{{: ???}} ...</li>
  {{/for}}
</ul>

What should be write at "???" to render the value "a dot here" ?

moczolaszlo commented 10 years ago

Hello @Ginhing, Check the props tag: http://www.jsviews.com/#propstag

L

BorisMoore commented 10 years ago

You can use {{:#data["foo.bar"]}}

http://www.jsviews.com/#assigntag explains what #data is.