← Webalkalmazás fejlesztők adatlapja
Nézd meg, miben segít
Angular-útvonalak és URL-állapot
Összehangolja a navigációt, rekordazonosítókat és szűrőket az újratölthető, megosztható böngészős URL-lel.
angular-router
Ezt a skillt használó csapattagok
Mikor hasznos?
Akkor használd, ha a Vissza gomb vagy rekordváltás után régi adatok maradnak a képernyőn.
Miben segít neked?
- Újrafelhasznált komponensnél is reagál az útvonalparaméterek változására.
- Az URL-ben őrzi a megfelelő szűrőket, lapozást és lapválasztást.
- Kezeli a késleltetett útvonalakat és mentetlen adatokat, szerveroldali jogosultság mellett.
Például ezt kérheted
Javítsd az ügyféllistát, hogy a megosztott szűrők, Vissza–Előre navigáció és azonosítóváltás helyes adatokat mutasson. Nyiss szűrt hivatkozást új lapon, majd válts két ügyfél között. Az URL, az aktív szűrő és a megjelenített rekord maradjon összhangban.
Részletes dokumentáció
Itt a skill eredeti útmutatóját, példáit és ellenőrzési szempontjait olvashatod az eredeti nyelven.
Összecsukás
Angular Router & URL State
Keep navigation, route parameters, query filters and lazy-loaded feature boundaries synchronized with the browser URL so deep links, reloads and Back/Forward navigation work reliably.
1. Route configuration and lazy loading
- Organize routes along feature boundaries using
loadComponentandloadChildrenso heavy feature bundles load on demand. - Place feature-scoped services and stores in the route's
providers: [...]array when their lifetime should match that route subtree. - Check whether
withComponentInputBinding()is enabled inprovideRouter(...): when enabled, route params, path data and query params bind directly to component@Input()/input()properties; otherwise, read them reactively fromActivatedRoute.
2. Reacting to same-component route and query parameter changes
- Angular reuses the same component instance when only route params (
:id) or query params (?page=2&q=foo) change on the same route configuration. - Never read
route.snapshot.paramMaporroute.snapshot.queryParamMaponly once inngOnInitwhen the user can navigate between items or filter states on the same route; subscribe toroute.paramMap/route.queryParamMap(withswitchMapto cancel stale loads) or usewithComponentInputBinding()signal inputs. - Update URL filter/pagination/tab state with
router.navigate([], { relativeTo: route, queryParams, queryParamsHandling: 'merge' })so refresh and link sharing preserve the user's view.
3. Guards, resolvers and scroll/focus restoration
- Prefer functional guards (
CanActivateFn,CanDeactivateFn,CanMatchFn) returning aboolean | UrlTree(orObservable/Promisethereof) in modern Angular, matching the project's existing guard style. - Use
CanDeactivateFnto protect unsaved form drafts from accidental navigation. - Treat client-side guards strictly as UX navigation flow: real authorization must always be enforced on the server.
Before you finish
- Same-component parameter and query changes reload data reactively via
paramMap/queryParamMapor route input bindings. - Direct URL entry, browser Back/Forward and page reload preserve expected state.
- Guards return
UrlTreeredirects cleanly and are never treated as a substitute for server authorization.
Csomagban lévő fájlok 2
LICENSE.txtSKILL.md
