Angular 2 Event emitters vs Subject

前端 未结 3 2007
Happy的楠姐
Happy的楠姐 2020-12-04 20:46

In Angular 2 what is the difference between Event Emitter and Subject for announcing an event? It seems like event emitters are less complicated to declare....Which way is p

3条回答
  •  爱一瞬间的悲伤
    2020-12-04 21:36

    EventEmitter by default is synchronous, whereas Subject is not. You can pass a flag to EventEmitter to make it asynchronous.

提交回复
热议问题