Initially i thought of using subjects but the value won’t change regularly. I just have to pass the user id in the beginning to multiple components. Which is the best way to pass? @Input decorator or subjects?
Any suggestions will be appreciated!
service is the better way to pass data one component to multiple components, if you want to pass data from one parent component to multiple child components, in that case better way is @input decorator. If you want listen data changes in other components when passed data from other component in that case we can use subjects and subscribe.
Answered By – madhukar reddy
Answer Checked By – Katrina (AngularFixing Volunteer)