Questions tagged angular-router

Explore the latest questions and answers asked by our top developers.

Angular route – how to change param value, having query params and relative navigation

I have following example of routes: identification/:myId/view/type1 identification/:myId/view/type2 These routes load different components, but then can have following subroutes: identification/:myId/view/listtype1/item/:itemId identification/:myId/view/listtype2/item/:itemId loading the same component. From the sub-component I have possibility to return back to the listtype1/2 using this.router.navigate(["../.."]). Additionally both routes can have some query params, like this: identification/:myId/view/listtype2;filter=myFilter that can be sent to […]

By OldShaterhan
Categorized as angular, angular-router Tagged ,

Angular: How to dynamically go back?

I help with something. I have 3 components, A, B, C. My application starts on component ‘A’. The user is able to get into component ‘B’ from multiple routes/components. Component ‘B’ has a link to component ‘C’. Here is the the problem… I want component ‘B’ to always go to the previous page. location.back() doesn’t […]

Angular Router: ERROR RangeError: Maximum call stack size exceeded

When I use a component with a route path, I get the following error: ERROR RangeError: Maximum call stack size exceeded at Array.unshift (<anonymous>) at findPath (router.js:1210) at findPath (router.js:1208) at findPath (router.js:1208) at findPath (router.js:1208) at findPath (router.js:1208) at findPath (router.js:1208) at findPath (router.js:1208) at findPath (router.js:1208) at findPath (router.js:1208) When I remove the […]

By skwny
Categorized as angular, angular-router Tagged ,

How to solve error NG8002: Can’t bind to ‘routerLink’ since it isn’t a known property of ‘a’.?

I work on angular 11 I face error when build angular app ERROR in src/app/Employee-list/employee-list.component.html:22:45 – error NG8002: Can’t bind to ‘routerLink’ since it isn’t a known property of ‘a’. <a class="nav-link text-dark" [routerLink]="[‘/employee-list’]">Staff List</a> and below is package json file "@angular/animations": "^11.2.14", "@angular/cdk": "^12.1.3", "@angular/common": "^11.0.0", "@angular/compiler": "^11.0.0", "@angular/core": "^11.0.0", "@angular/forms": "^11.0.0", "@angular/material": "^11.2.13", […]

Angular Router: Why do I get a value from queryParams but not from paramMap?

So I have a service in my angular app that is injected when I navigate to my route soquestion/:id. In the constructor of the service I have the following code: constructor( private route: ActivatedRoute, ) { this.route.queryParams.subscribe((params: any) => console.log(params)); this.route.params.subscribe((params: any) => console.log(params)); } The first subscription prints a value in the console while […]

By hullunist
Categorized as angular, angular-router Tagged ,

How to return from auxiliary routes in an Angular 12 app

I have an Angular 12 app which displays a list of things on the left and the detail of the selected thing on the right. Because users should be able to get a deeplink to a specific thing, the selection is done through the Angular router. This part can be easily done and there are […]

Angular Router duplicates parameters

I’m developing an app that uses Angular 11. My current routes are a bit complex so I’m just going to paste the code. Here are my routes: export const globalRoutes: Routes = [ { path: ”, redirectTo: ‘home’, pathMatch: ‘full’ }, { path: ‘login’, loadChildren: () => import(‘./components/login/login.module’).then(m => m.LoginModule) }, { path: ‘home’, component: […]

Angular Route Reuse Strategy update cached state with changes from other routes

I have an app with the following setup: An overview Route that contains multiple sections ‘overview’ . Users can navigate to each section activating the Route ‘section/:id’. I’ve implemented angular Route Reuse Strategy for the route ‘overview’ to prevent re-rendering for the whole section list when navigating from ‘section’ back to the ‘overview’ list. Changes […]

Angular 9 frontend/springboot backend – How to solve CORS error when calling router.navigate(url)

I have Angular frontend and Springboot backend. My Springboot controller is annotated with @CorsOrigin like below which based on my reading will enable CORS on all endpoints in this controller; however that is not the case for some reason: @CrossOrigin(origins = "http://localhost:4200") // to prevent CORS error in Angular, use url of Angular app @RestController […]

By pixel
Categorized as angular, angular-router, cors, spring-boot Tagged , , ,

Delayed CanActivate in Angular Router blocks rendering

I have a mat-table with 3000 rows (array with mock data) behind a CanActivate guard. Based on CanActivate docs, it can return both boolean or Observable<boolean>. If it returns true, mat-table component loads instantly. Now, I want to use the CanActivate to see if user has logged in. Here is an observable that will wait […]

1 26

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us