I have created a web component in Angular Elements which defines and emits events like this:
@Input() groupId: number = -1;
@Output('group_change') groupChange!: EventEmitter<number>;
...
this.groupChange.emit(groupId);
I have added the web component to a JavaScript application with an event listener:
this.myAngularElement.addEventListener('group_change', evt => {
console.log(evt);
});
What is unexpected is that the number has been converted to a string in the event listener. Is there an explanation for why this happens, and maybe even a way to prevent it?
Via Active questions tagged javascript - Stack Overflow https://ift.tt/yAMKqGJ
Comments
Post a Comment