What is the correct way to add options binding to custom attribute that overrides repeater?
For example in bcx-aurelia-reorderable-repeat
package there is the following syntax:
<div reorderable-repeat.for="item of items" reorderable-group="${group}">${item}</div>
reorderable-repeat
uses the following code to get reorderable-group
value:
_reorderableGroup() {
if (this.viewFactory && this.viewFactory.viewFactory) {
const node = this.viewFactory.viewFactory.template.firstChild;
const targetId = node.getAttribute('au-target-id');
const instruction = this.viewFactory.viewFactory.instructions[targetId];
if (instruction) {
const bi = instruction.behaviorInstructions.find(bi => bi.attrName === 'reorderable-group');
if (bi) {
const exp = bi.attributes && bi.attributes['reorderable-group'];
if (exp && typeof exp.createBinding === 'function') {
// binding expression or interpolation binding expression.
return exp;
}
}
}
}
return this._getPlainAttribute('reorderable-group');
}
But the above code fails when repeater is combined with custom attribute, that changes context. For example reorderable-repeat.for
do not work together with with.bind
:
<div reorderable-repeat.for="item of items" with.bind="item">
because it can’t get the value of reorderable-group
using node.getAttribute('au-target-id')
technique