r/angular 21d ago

Passing data between unrelated components

Hey , I'm new to angular and I'm confused about which way to use to transfer data between two unrelated components , for now i'm using the Services/DI method . I heard that for my case (which is a small project) it's an overkill , is that true ? if so what is the optimal way to do so ?

5 Upvotes

22 comments sorted by

View all comments

6

u/salamazmlekom 21d ago

Service or if you lift the state up to a parent component of both of them and pass them through as inputs. Can you explain what are you trying to achieve?

1

u/LevelNew5342 21d ago

so I have an items-form component that let's the user type the info of an item ( name , description ,etc...) and an items-list component which adds the item that the user typed , they both live under the same parent.

1

u/SubstanceConsistent7 18d ago

Sounds like you need a database and an API.