Is there any alternative for @Input() and @Output() for sending data between components in angular?
Asked
Active
Viewed 40 times
-3
-
Do you mean a different syntax or a whole different way of data exchange? – nvoigt Apr 13 '18 at 13:32
-
Yes, you can use a service, and, in that service you can have observables / event emitters, so, in that components you can subscribe to service events. – mduraes1994 Apr 13 '18 at 13:32
-
What kind of alternative? For what purpose? – Dan Macak Apr 13 '18 at 15:07
1 Answers
4
There is an entire section in the official docs dedicated to this topic. Check it out.
The gist of it:
@Input()
and@Output()
@ViewChild()
and template variables.- via a service (with
Subject
andObservables
)

Tomasz Kula
- 16,199
- 2
- 68
- 79