slimjs / slim.js

Fast & Robust Front-End Micro-framework based on modern standards

Home Page:http://slimjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nested datasource property in repeaters

osher opened this issue · comments

commented

consider the following template:

<ol>
  <li s:repeat="receipt.products">
    <span>{{data.name}}</span>
    <br>{{data.effects.length}}
    <ol>
      <li s:repeat="data.effects as effect">{{effect.name}}</li>
    </ol>
  </li>
</ol>

the data.effects.length prints correctly the number of elements, but the nested repeater does not see the data 😢

The bindings takes effect on data property, not the effects nested property.
If you re-set the data, does this work?

commented

Can you please elaborate what do you mean by "re-set the data"? I don't set it anywhere, it's all templates magic

resetting the data, even if unchanged
this.data = this.data or this.commit('data');

The first one invokes the setter function, which automatically invokes the commit.