English
Topic 17. Routing, forms and layout: lazy routes, sign-in and registration forms, the responsive shell
Goal: build the frame of the application: toasts and dialogs, sign-in and registration with Reactive Forms that show the server's field errors, lazy routes protected by the guards, and the responsive shell with a navigation rail, bottom tabs and the theme switch.
Where we are
The first screens (Fig. 17.1). After this topic a user can register, sign in, reload the page without losing the session, and move around an (empty) application.
Fig. 17.1. Routes, forms and the shell
- Starting point: topic 16 — the client knows the API, keeps the session and adds tokens; 19 tests pass.
- At the end of the topic you can register and sign in in the browser; the shell shows the navigation and the "Select a chat" page in light and dark themes. The 19 tests still pass.
Steps
- Toasts and dialogs — a toast service with signals · the toaster · dialogs with Angular CDK · the root component
- Sign-in and registration — content projection · Reactive Forms · validation messages · server field errors · the return URL
- The shell and the routes — lazy routes · guards on routes · the responsive layout · the theme switch
- Checkpoint — what must work, self-check questions and exercises
Materials
- Course slides, part 4, Real time and the TypeScript client (slide "Responsive UI under a strict CSP")
app.routes.ts,features/auth/,features/shell/toast.service.ts,toaster.ts,dialogs.tsDocs/Frontend.md– layouts and the Content-Security-Policy