how to use @Emit for multiple parameters
See original GitHub issuefor example: ` @Emit(‘reset’) returnMultipleValue() { return a, b, c; }
/equivalent to/
this.$emit(‘reset’, a, b, c); ` And I can receive multiple parameters。
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How pass 2 parameters to EventEmitter in Angular?
If you look at the EventEmitter emit method @ angular.io, it can only take a single parameter of type T. emit(value?: T).
Read more >VueJS Custom Event - Emit Multiple Values - Cody Bontecou
To emit more than one parameter, it's best to pass the data as an object: # · Access the parameters from the parent...
Read more >Emit Multiple Values from Child to Parent in a Vue.js Custom ...
To emit more than one parameter, it's best to pass the data as an object: · Access the parameters from the parent component...
Read more >How to pass two parameters to EventEmitter in Angular 9
EventEmitter allows us to emit any type of object, so we will take advantage of it. For passing the parameters, we will wrap...
Read more >Livewire emit with multiple parameters - error - Laracasts
I am trying to emit an event that gets 2 parameters. I get the error: Unable to resolve dependency [Parameter #1 [ $id...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@foxbunny
why that (comma expression) is not legal js?
@yunweb
return a, b, c;
is not legal JavaScript. Normally, JavaScript parsers (including TypeScript) would throw a syntax error right there. What @jacobrabjohns suggests is the best way to do it.Personally, I think it’s cleaner to just use
this.$emit()
anyway. It makes it clearer about when exactly it is going to be called and with what arguments, and decouples the implementation of your method from the stuff you want to emit. But that’s just me.