slim.js icon indicating copy to clipboard operation
slim.js copied to clipboard

if directive inside foreach directive

Open jbruni opened this issue 3 years ago • 3 comments

Consider this template:

<li *foreach="{{ this.items }}">
  <a href="{{ item.url }}">{{ item.name }}</a>
  <p *if="{{ item.foo }}">bar</p>
</li>

While item.url and item.name render as expected... the item within the *if is always undefined.

I'm not sure if this is expected, or a bug, or how to make it work as intended. Any help is appreciated.

Thanks!

jbruni avatar Aug 12 '21 10:08 jbruni

It looks like a bug, as the parser should postpone the *if until the item context is ready. I'll look into it.

eavichay avatar Aug 22 '21 19:08 eavichay

Hi, @eavichay Any progress on this? Btw: thanks for a great framework :)

arfelarfe avatar Mar 15 '22 14:03 arfelarfe

Would love to use it too!

mateusz-lisik avatar Sep 20 '22 17:09 mateusz-lisik