DomTemplate icon indicating copy to clipboard operation
DomTemplate copied to clipboard

data-bind:list

Open g105b opened this issue 3 years ago • 0 comments

To make things nice and simple with nested lists, a new bind key can be used to specify which property of the bound object should be used for automatically binding the nested list.

<ul>
  <li>
    <h1 data-bind:text="name">Name goes here</h1>
    <p>Categories:</p>
    <ul data-bind:list="categories">
      <li data-template data-bind:text="name">Category name goes here</li>
    </ul>
  </li>
</ul>
$iterable = getListOfThings();
$iterable[0]->categories = getCategoriesForThing(); // silly example, but it makes sense
$binder->bindList($iterable);

g105b avatar Aug 03 '22 17:08 g105b