⊗jsagPmRtRd 94 of 97 menu

Redirection in Routing in Angular

In Angular, you can redirect routes to another path. This is done using the redirectTo key, which specifies the URL to which the request should be redirected.

Let's take this as an example: if the required route for a request is not found, we redirect it to the main page:

const appRoutes: Routes =[ { path: '', component: HomeComponent}, { path: 'aaaa', component: AaaaComponent}, { path: '**', redirectTo: '/'} ];

Redirect URL /bbbb/ to /aaaa/:

const appRoutes: Routes =[ { path: 'aaaa', component: AaaaComponent}, { path: 'bbbb', component: BbbbComponent}, ];
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline