I'm using LitElement webcomponents with an angular application
I implemented two ways data binding with a CustomEvent dispatch but I would like to use angular's banana-in-a-box syntax sugar.
Example : this stackblitz : a webcomponent with an integer property that could be incremented within the webcomponent itself
Current syntax :
<hello-world [counter]="counter" (counterChange)="counter = $event.detail.value"></hello-world>
Syntax I want to achieve :
<hello-world [(counter)]="counter"></hello-world>
When I increment from within the webcomponent the event is caught by angular because the name of the event corresponds to the name of a property + Change
(counterChange
) but the whole CustomEvent is assigned to the value instead of the $event.detail.value
value
From what I read in the documentation, angular achieves this with the EventEmitter model, which according to the code are rxjs Subjects, I'll try to go this route instead of the CustomEvent route.
If anybody has any clue on how to achieve this I'd love some tips :)
Thanks !