Questions tagged angular-router

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

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
Published
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
Published
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
Published
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 […]

Problem calling my Angular application entry point with an ID – Cannot match any routes

So my problem is pretty basic but for some reason, I can’t get it to work: I want my application to be called with an ID. Something like: myapplication.com/1234 – where 1234 is an ID. Being provided an Id is a must for the start component. To do this I created two routes: export const […]

By hullunist
Published
Categorized as angular, angular-router Tagged ,

Filtering for NavigationEnd events in Angular 12?

In Angular 11 this works: this.r.events.pipe( filter(event => event instanceof NavigationEnd), map((event: NavigationEnd) => event.url == ROUTES.APPLICATION)) However in Angular 12 it produces the error: Argument of type ‘MonoTypeOperatorFunction<Event_2>’ is not assignable to parameter of type ‘OperatorFunction<Event_2, NavigationEnd>’. Type ‘Observable<Event_2>’ is not assignable to type ‘Observable<NavigationEnd>’. Type ‘Event_2’ is not assignable to type ‘NavigationEnd’. Property […]

1 2 3 29

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
faq