jumrifm jumrifm - 1 year ago 234
Javascript Question

Angular 2 EventEmitter performance

I'm working on web-app based on Angular 2. In Angular 1 we had two-way data-bindings, so services could be easily connected with page data using $scope (if we change something in service, data will be automatically updated).

In Angular 2 we have EventEmitter, I thought it's like Angular 1's $scope.$broadcast, so there could be performance issues with this.

What about performance of EventEmitters? Do they slow down application?


Events emitted by EventEmitter don't bubble and also don't broadcast. EventEmitters are for binding from child to parent only.

For broadcasting use shared services.

See also
- https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#bidirectional-service
- updating variable changes in components from a service with angular2
- Delegation: EventEmitter or Observable in Angular2