You can check if the first item is displayed.
<div data-bind="foreach: items">
<hr data-bind="visible : $index()!=0" />
<span data-bind="text: $data"></span>
</div>
See violin
Or, as RP Niemeyer said, you can omit the last hr:
<div data-bind="foreach: items">
<span data-bind="text: $data"></span>
<hr data-bind="visible : $index() != ($parent.length-1)" />
// notice the hr is after the item.
</div>
source
share