Show the price on the product card
Angular · Angular · beginner · modification
Adds the price to the product card in the catalogue grid. `product.model.ts` gains the two fields the products API already returns, `priceCents` and `currency`, and `product-card.component.ts` shows the price under the product name with Angular's `CurrencyPipe`, in the product's own currency, styled with the theme's default text colour.
Angular 21 storefront (standalone components, signal inputs). The catalogue grid (`catalog-grid.component.ts`, unchanged) loads `GET /api/products` through `CatalogService` (unchanged), which passes the JSON objects through as `Product` without converting any field, and renders one `<app-product-card [product]="p" />` per product. The API has returned `priceCents` and `currency` with the contract in requirement 2 since the last backend release; until this PR the web app ignored them. The app runs with Angular's default locale, `en-US`, and registers no other locale. The theme tokens (`--fg-default`) come from the global `styles.scss`.
Requirements
- Each product card in the catalogue grid shows the product's price under its name, formatted with Angular's `CurrencyPipe` in the product's currency: a product with `priceCents: 1999` and `currency: 'EUR'` shows `€19.99`, and one with `priceCents: 500` and `currency: 'USD'` shows `$5.00`.
- The price comes from the existing `GET /api/products` response. Its contract: `priceCents` is the price in cents (the currency's minor unit), a whole number from 0 to 10,000,000; `currency` is `'EUR'` or `'USD'`, both of which have two decimal places.
- A price of 0 shows as `€0.00` or `$0.00`, like any other price (no special label).
- Unchanged: the card's image and name, and the grid that lists the cards.
Files touched
- src/app/catalog/product.model.ts
- src/app/catalog/product-card.component.ts