The @Input API is used with the
parent-child-grandchild script . If you have
routing and
related components , the
@Input API will not help you everywhere. You need to manage the
parent and
child if you want two-way communication. Later, over time, it becomes difficult to manage.
If you have
routing and
the parent-child-grandson / mother tongue components , you can go with the
shared service . If the variables change in the service, you can update the component using the
RXjs library. You must manage everything in one place and
subscribe to an observable in the component where you plan to use the service.
So, I, according to me, shared service , is a good solution with the Rxjs library. You can make a singleton service by entering it in the boot function.
source share