Hello,
I have the following simplistic list rendering (I thought I would try out $previous to simplify rendering navigational tabs):
<template repeat.for="module of tabsModel; key: module.topic">
<!-- <test harness to see if $previous ever contains anything> -->
<div>${$previous}</div>
<!-- <actual markup> -->
<div if.bind="module.groupKey !== $previous?.groupKey" class="tsi-bid-navigator-nav-group">
${groups[module.groupKey]}
</div>
<div>${module.title}</div>
</template>
I included an extra div above that references $previous just to see if it renders anything at all. It doesn’t. It is the only contextual property that doesn’t. I went through the table of contextuals in the documentation, and all the rest work. The if.bind is always true since $previous?.groupKey is always undefined.
I even tried setting contextual to true explicitly:
<template repeat.for="module of tabsModel; key: module.topic; contextual: true">
...
</template>
That didn’t work, either. $previous never contains any data.
For completeness, here’s a fragment of tabsModel from back on the viewModel:
this.tabsModel = [{
groupKey: 'project',
title: 'correspondence',
topic: 'correspondence',
},
{
groupKey: 'project',
title: 'files',
topic: 'files',
},
{
groupKey: 'tools',
title: 'Weather',
topic: 'weather',
},
{
groupKey: 'tools',
title: 'Mobilization',
topic: 'mob',
},
{
groupKey: 'masterbid',
title: 'factors',
topic: 'factors',
}
...
]
I even loaded the 12/1/25 browser extension posted by @dwaynecharrington to see if the repeat.for controller showed up there with the contextuals. It does, but none of the contextuals displays. It simply reads “repeat module of tabsModel”.