What is the proper use of an EventEmitter?

后端 未结 4 1745
无人及你
无人及你 2020-11-22 01:53

I\'ve read questions like Access EventEmitter Service inside of CustomHttp where the user uses EventEmitter in his service, but he was suggested in this comment not to use

4条回答
  •  爱一瞬间的悲伤
    2020-11-22 02:28

    When you want to have cross component interaction, then you need to know what are @Input , @Output , EventEmitter and Subjects.

    If the relation between components is parent- child or vice versa we use @input & @output with event emitter..

    @output emits an event and you need to emit using event emitter.

    If it's not parent child relationship.. then you have to use subjects or through a common service.

提交回复
热议问题