1

Why Event Emitter can't use in service in angular 6?

In Angular documentation they mentioned, "Use in directives and components to emit custom events"

Akshay Parekh
  • 41
  • 1
  • 7
  • 1
    EventEmitter is supposed to be used only for `@Output`, which services cannot have. You're not supposed to manually subscribe to emitters, it's for template bindings only. – Ingo Bürk Aug 31 '18 at 06:18

1 Answers1

0

Because in services all waht you have to do is manipulating data, if you want to notify the data changes you can use Subjet or BehaviorSubjet. EventEmitter is generally used to notify changes from child to parent and as said is supposed to be used only for @Output.

please take a look at this link

BELLIL
  • 739
  • 10
  • 23