Separating the App into Components

Angular intends for you to design your UI around components. Instead of one big page, you’re intended to create smaller, reusable or self-contained bits of HTML and code that can be pieced together. This is a common pattern in other JavaScript libraries, such as React,[77] and it’s a great way to organize complex user interfaces like our customer details page. This is different than the way Rails thinks of a UI, which is, instead, as a collection of HTML templates. You could think of partials as components, but partials are just a way to reuse HTML; there’s no behavior associated with them.

Let’s pick out the components from our existing UI. The following screen shows what it looked like at the end of Chapter ...

Get Rails, Angular, Postgres, and Bootstrap, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.