Hi,
Kindly let me know how to redirect from one component to another in Angualar 8
like Login component to Homepage component.
Thanks
Sathish
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sandhiya PriyaPosted Jan 6, 2026, 4:25 AM
In Angular 8, redirecting from one component to another is done using the Angular Router. You don’t “switch components” directly — instead, you navigate to a route that loads the target component.
Steps to Redirect (Login ? Homepage)
1. Configure Routes
In
app-routing.module.ts:2. Inject Router in Login Component
In
login.component.ts:3. Add Router Outlet
In
app.component.html:This is where Angular loads the component based on the route.
4. Example Flow
User opens
/login?LoginComponentloads.On successful login ?
this.router.navigate(['/home']).Angular loads
HomeComponentinto.Summary
Define routes in
app-routing.module.ts.Use
Routerservice to navigate programmatically.acts as the placeholder for components.Chittaranjan SwainPosted Jul 29, 2019, 3:19 AM
Sivakumar KonetiPosted Jul 25, 2019, 3:13 AM
Sanwar RanwaPosted Jul 24, 2019, 2:11 AM