Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Angular Basics Services in Angular Connecting a Service and Component

Eli Levit
Eli Levit
4,482 Points

Why we need entry-list.component?

I just didn't understand why do we need entry-list.component? If we have entry.component why can't we just put all these methods and services there??

1 Answer

Miguel L贸pez
Miguel L贸pez
7,055 Points

You can say that the whole app can be in a single component if you want but It is better to decompose your app into smaller reusable and easy to mantain components. For a kind of item/list/detail app will be better if you have a item component wich can be a single photo and a list component wich is a list of items. It does not matter how complex your item component can be, you will have only the code that corresponds to that piece.

At the begining this can feel like an unnecesary thing because you have just a few lines written but planning a good structure can save you a lot of time in the future.