Book Detail — Facts

Overview

Standalone BookDetailComponent (route /books/:id). Shows one book and an Add to cart button. Renders a “not found” branch when the id doesn’t match.

Component tree

Single component, no children. Uses RouterLink (back link + cart link) + CurrencyPipe. Template is one @if (book(); as b) { … } @else { not-found }.

Data flow

Routes & params

/books/:idid is the Book.id slug (e.g. dune, clean-code). Unknown id → not-found view (no redirect).

Key files

RoleFile
Componentapp/src/app/pages/book-detail/book-detail.component.ts
Template…/book-detail.component.html
Styles…/book-detail.component.scss
Dataapp/src/app/services/book.service.ts
Cart stateapp/src/app/services/cart.service.ts
Modelapp/src/app/models/book.ts

Gotchas

[[book-list]] (links here) · [[cart-checkout]] (consumes what Add-to-cart writes).