Consider two component c1, c2
. I want to transfer some data from c1
to c2
.
One way I could do it is to create an EventEmitter
with @output
in c1
and .emit()
when need to. Then .subscribe()
it at c2
and get the data.
As far as I know using rxjs::Subject
is better than using EventEmitter
because the last expands the rxjs::Subject
. So why would I use @output EventEmitter
at all? I could always just use rxjs::Subject
..
In which circumstances I would use @output EventEmitter
variable?
My Guess:
Two cases:
1. Using services: Using Subject
instead of EventEmitter
due runtime performance.
2. not Using services: Then I have to declare @output
. Then, when using @output
, EventEmitter
is necessary to use. Then use EventEmitter
over Subject
.