Is there a way to pass parameters between components other than using ActivatedRoute? Currently, I am utilizing ActivatedRoute.
In component1.ts
this.router.navigate(['/rate-list', 1]);
In app.module.ts
{ path: 'rate-list/:a', pathMatch: 'full', component:
RateListComponent },
In component2.ts
ngOnInit() {
this.parameter.sub = this.route.params.subscribe(params => {
this.parameter.a = params['a'];
console.log(this.parameter.a);
});
}
The current setup is functioning correctly and creating a URL like http://localhost:4200/rate-list/1. But my goal is to create a URL in the format of http://localhost:4200/rate-list?a=1. Is it possible to achieve this type of URL structure? If so, how can it be done?