Questions tagged [angular-activatedroute]
118 questions
1
vote
0 answers
Unit testing ActivatedRoute queryParams unsubscribe on destroy of a component
I am trying to test the ngOnDestroy() method of this component but not able to find the correct way to do that. What should be the right way to do it?
import {Component, OnDestroy} from '@angular/core';
import {ActivatedRoute} from…

Rudra
- 1,678
- 16
- 29
1
vote
3 answers
How pass parameters from urlA to urlB without show them in the url
I need to pass parameters from URLA o urlB whithout and the urlB must be show ( so I can't use skiplocation=true).
in my ts I do ( in URLA) :
this.router.navigate([URLB], {
queryParams:
{
name:…

poopp
- 1,297
- 2
- 13
- 23
1
vote
0 answers
angular 8 getting ActivatedRoute paramMap is including the queryParams on page load
My actual component and app is a bit more complicated. However, I just wanted to see if there's possibly something simple I am missing. I am unable to get the correct paramMap from the ActivatedRoute. This happens when the url also contains…

thienedits
- 316
- 1
- 3
- 9
1
vote
3 answers
Angular 6 QueryParams Not available OnInit?
Okay so I am creating a simple page which i want the user to pass in a bunch of parameters via the URL. The very basic example I have been using is http://localhost:4200/?client_id=test
I am following all the procedures I can find on the internet…

Matt Goodis
- 393
- 1
- 3
- 11
1
vote
1 answer
angular navigation and validation - routes with params
in my project i have some routes that accept parameters.
couple of my routes (siblings):
{
path: '', component: HomeComponent,
},
{
path: 'factories', component: FactoriesComponent, canActivate: [AuthGuard],
resolve:…

guy
- 111
- 3
- 9
1
vote
1 answer
How to make checkbox checked from the query parameters?
I want to bind my checkboxes to query parameters.
For example: I have:
http://localhost:4200/products?pageNumber=1&pageSize=16&lenscolor=1&lenscolor=2
And after page loading, my colors checkboxes with appropriate id (1 and 2) must be checked. I…

Taras Svidnytskyy
- 123
- 3
- 11
1
vote
1 answer
How to get Parameter value in Common component in Angular 6
I have HeaderComponent which is common for all pages and appears on each page. so, I have created separate Component for Header and added in app.component.html using selector. I have created two child pages "Home" and "Second" and route it using…

Ubiquitous Developers
- 3,637
- 6
- 33
- 78
1
vote
2 answers
Angular - How to subscribe to child route params only when the child route is activated
I have a split screen design. I'd like to access the folder ID from the parent route only when the child route is activated. The below works in getting the correct params for me, but on the initial load where I'm only displaying the parent route, I…

Que
- 957
- 2
- 14
- 35
1
vote
0 answers
Can't Read Query Parameters From Promise
I am trying to read the query parameters from a URL in Angular like so:
export class QueryParameterReader implements OnInit {
constructor(private currentActiveRoute: ActivatedRoute) {}
ngOnInit() {
…

shinvu
- 601
- 2
- 7
- 23
1
vote
2 answers
Investigate activatedRoute observables using rxjs operators
I have a quite simple request:
I would like to investigate the activateRoute observables (both paramMap and queryParamMap) - I would like set component variables according to the results of them.
Tried doing that using rxjs operators pipe and…

Guy E
- 1,775
- 2
- 27
- 55
1
vote
1 answer
ActivatedRoute.queryParams is undefined after screen refresh in Angular 5
Please help!
So I have the following url
https://xxx.io/#/route1/yyyyyyyy?tj=3&bd=7
And when I navigate to it, I have code the following code:
this.route.queryParams.subscribe((res: any) => {
console.log('tj: ' + res.tj)
…

user1974753
- 1,359
- 1
- 18
- 32
1
vote
3 answers
How to access the URL parameters from any Angular component?
I have an app whose components are structured as below:
1. Fam.Component
1.1. Header.Component <------ Unable access param from here
1.2. ParentGrid.Component
1.2.1. ChildGrid.Component
1.2.1.1 GrandChildGrid.Component <----- Can access from…

Nandun
- 1,802
- 2
- 20
- 35
1
vote
1 answer
Test double for ActivatedRoute not working
The Angular documentation mentions a test double for ActivatedRoute:
import { convertToParamMap, ParamMap, Params } from '@angular/router';
import { ReplaySubject } from 'rxjs';
export class ActivatedRouteStub {
private subject = new…

shiv_saz
- 65
- 6
1
vote
1 answer
Angular: pass complex JSON via routerLink
I'm using Angular 5 and I have this ngFor:
and I need to access from the routed…

Stack Diego
- 1,309
- 17
- 43
0
votes
0 answers
Angular ActivateRoute is empty on a Hybrid app (Angular & AngularJs running simultaneously)
We have an application which was developed using AngularJs and then we start migrating to Angular 16. Most of the things working as expected.
Now I wanted to use a new angular component within old Angular component. This new component need to…

Rumesh Wishwa
- 56
- 7