Tuesday, November 29, 2022
Angular 8Angular 9Angular7

How to get Query Params from redirected URL in Angular 9?

Angular 9, Angular 10

Hello to all, welcome to In this post, I will tell you, How to get Query Params from redirected URL in Angular 9?

Here is the working code snippet and please use carefully:

1. Here is the code for First Component and that I have added into my app.firstcomponent.ts file:

Here I am setting data

import { Router } from '@angular/router';

export class FirstComponent implements OnInit {
adduserdata = "First Component";
constructor(private router: Router) { }

//Button click function or you can try it with api callig also
 // Set QueryParameter
 this.router.navigate(['secondcomponenturl'], {queryParams: {data : this.adduserdata}});


2. Here is the code for Second Component and that I have added into my app.secondcomponent.ts file:

Here I am getting the data

import { ActivatedRoute, Router, NavigationEnd  } from '@angular/router';

export class SecondComponent implements OnInit {
constructor(private route: ActivatedRoute) {}

ngOnInit(): void {


If you have any kind of query then please let me know.


Thank you

the authortherichpost
Hello to all. Welcome to Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 8, Angular 9, Angular 10, Angular 11, Angular12, Angular 13, Angular 14, Angular 15, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.