Cascading form fields: pick a country and the city list updates; pick a category and the product list updates. Child fields depend on their parents.
The problem it solves
The form is made of linked fields, and every parent change requires reloading the children's options. Do it imperatively — with subscriptions and manual setValue — and sooner or later the response for the old country (US) arrives after the user has already picked a new one (DE), and NY and SF show up in the dropdown instead of Berlin and Munich.
Operators and why they matter
combineLatest — gathers the current (country, category) pair into one stream.
startWith — gives initial values so the VM appears immediately, not after the first change to each field.
switchMap — on a new combination, cancels the options load for the old one.
map — turns the reference data into a compact view model for the template.
Gotchas
mergeMap instead of switchMap — an old slow response overwrites the new options.
Without startWith, the template stays empty until the user touches every field — combineLatest stays silent until all sources have emitted at least once.
An imperative setValue inside the pipeline without a guard creates an infinite valueChanges loop.
What you get
The form always shows options for the last consistent combination of parent fields. No ghosts from the past.