I have created a custom structural directive similar to ngFor
. When I try to use it using <template>
element syntax, the binding inside the template is working but when I use * syntax, the binding is not working.
<!-- working -->
<template edit [editOf]="values" let-val="val">
<table >
<span>This is using template syntax {{val}}</span>
</table>
</template>
<!-- not working -->
<table *edit="let val1 of values">
<span>This uses star syntax {{val1}}</span>
</table>
Here is the plnkr link for this issue.
What am I doing wrong?
Update:
I think, now I understand what is going on. The let-val
is incorrectly set to a property val
of object used for binding but I need the whole object. So, the let-val
shouldn't be assigned with any value in the template and then I'll have to update the context.$implicit with the object used as binding source in the viewRef.
Working plnkr here.
Thanks to @robisim74