How to Redirect to another Page in Angular?

How to Redirect to another Page in Angular?

In this post we will give you information about How to Redirect to another Page in Angular?. Hear we will give you detail about How to Redirect to another Page in Angular?And how to use it also give you demo for it if it is necessary.

Today, i am going to write angular tutorial about how to redirect to another route in angular 8 application. i want to give very simple example of redirect to another page in route file. we can easily redirect to another route using redirectTo in angular.

You can simply redirect to page in angular 6, angular 7, angular 8 and angular 9 application with this solution.

It’s pretty simple to redirect to another route url using redirectTo in angular application. but you maybe don’t know so you can simple see bellow app-routing.module.ts file and see how i declare routes and how i redirect that home page to another route.

You can see code of route define:


path: '',

redirectTo: 'redirect_route_name',

pathMatch: 'full'


you can just see bellow code and you will have solution for your angular app.


import { NgModule } from '@angular/core';

import { Routes, RouterModule } from '@angular/router';

import { BlogComponent } from './blog/blog.component';

import { PostsComponent } from './posts/posts.component';

const routes: Routes = [


path: '',

redirectTo: 'posts',

pathMatch: 'full'



path: 'posts',

component: PostsComponent



path: 'blog/:id',

component: BlogComponent




imports: [RouterModule.forRoot(routes)],

exports: [RouterModule]


export class AppRoutingModule { }

If you run your home page like this way:


It will redirect to this url:

Also see:How to Get User Agent in Angular?


I hope it can help you…

Hope this code and post will helped you for implement How to Redirect to another Page in Angular?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

  +  82  =  86

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US