Angular 5 variable between components


#1

I use angular5 and i have two components. I want to use in the seconde component a variable which is created in the first component. How can i do this?


#2

you may find a better answer on an angular-specific forum, since this issue isn’t glitch specific and i haven’t worked with angular since 2 came out, but typically how components work is that they get variables passed down from their parent component only - not from sibling components. so you can either make the second component a child of the first, or have a parent component that manages the state of both of them.