Questions tagged [angular-router-params]

30 questions
0
votes
1 answer

Need Help: Route Params in Angular 14

I'm learning Angular from Frontendmasters.com, During course, we're building this project (you can say: courses management system) Right Now: my url is ( localhost:4200/courses ) and it shows courses component which is container component and have…
0
votes
2 answers

How to write an Angular Unit Test for route.queryParamMap?

I've added a route.queryParamMap.pipe(..) to this project. However, now the unit test for the component fails with TypeError: Cannot read properties of undefined (reading 'pipe') inside "should create". I'm unable to find an adequate solution to…
kiwi
  • 53
  • 5
0
votes
1 answer

How to set and fetch specific values for route params in Angular

I have a set of routes like this: /users/:type/:id /users/admin/:id /user/manager/:id Now all of these use the same component. The catch is, admin and manager can see some extra stuff based on their type. Assuming I don't have a way to get these…
Vivek V Dwivedi
  • 2,510
  • 2
  • 28
  • 39
0
votes
0 answers

Prevent router to clear URL parameters from address bar in Angular 12

In angular 12, when I am trying to navigate to a route along with query parameters, I am able to get the values of those parameters but they are getting cleared from the url. I am using the below code to navigate: import { Component, OnInit } from…
0
votes
2 answers

How to retrieve queryParams passed to an Angular route via NavigateByUrl

How to retrieve params passed as NavigationExtras using navigateByUrl as described below from the target component in Angular ? let extras: NavigationExtras = { queryParams : { errorTitle: 'Erreur Technique', …
Ghassen
  • 591
  • 1
  • 15
  • 33
0
votes
1 answer

Angular 12 Routing shows UTF-8 characters like '%2F', '%3F' in the URL and shows can not match any routes. URLSegment error

I have an Angular app which needs to show the homepage after login. When the app logs in correctly, the URL shown in the URL bar contains UTF-8 characters like '!', '%2F', '%3F' which on reload shows the error Error: Cannot match any routes. URL…
0
votes
1 answer

Adding id to url of an angular component so user can use "back" in browser

I have a list of items that is getting displayed in a list.component from an angular Service. When the user clickes on one of those Items it shows an before via css hidden div that shows the details of the clicked item:
0
votes
1 answer

Unit test asynchronous code in a component in Angular 9

Update 2: Turns out it seems most likely that my new test is responding to the url params of the previous test when it is first loaded. This is obviously not what I want and likely means I need to change the routing. Is the only solution to reset…
0
votes
0 answers

angular router endless loop when navigated from from canActivate

As angular routers need static paths, I am using canActive to dynamically route my app. my main routing is as follows. import { NgModule } from "@angular/core"; import { RouterModule } from "@angular/router"; import { AuthGuard, AuthData} from…
0
votes
1 answer

Angular 8 Deeplinking on form submit

I have gone through few posts on deeplinking in Angular 8. But haven't found a better solution for my problem. Prob Requirement: enter image description here Please refer to the screenshot above. I have simple Angular application with two widgets…
0
votes
0 answers

Angular router navigation to children routes

This is how a route in my app-routing-module looks like. { path: 'subjects/:subjectId', component: MainComponent, canActivate: [AuthGuard], children: [ { path: 'slideset/:slidesetId', component: MainComponent }, …
Divyanshu Rawat
  • 4,421
  • 2
  • 37
  • 53
0
votes
2 answers

Angular router removes query params when deployed on IIS server

I try to use Angular router but I have some troubles when the app is deployed. First, here is my versions: Angular CLI: 6.2.3 Node: 9.11.1 OS: win32 x64 Angular: 6.1.9 ... animations, common, compiler, compiler-cli, core, forms ... http,…
0
votes
0 answers

How do I trigger the wildcard route when the url parameter is bad?

In Angular 6 I'm using an observable to manage fetching a detail record based on the URL parameter like so: ngOnInit() { this.hero$ = this.route.paramMap.pipe( switchMap((params: ParamMap) => { const id = parseInt(params.get('id'), 10); …
Rob
  • 3,687
  • 2
  • 32
  • 40
0
votes
1 answer

providing optional param to injectable service constructor - Angular2

There is AppComponent and SecurityService. ... @Injectable() export class SecurityService implements OnInit { private _url: string; constructor(private http: Http, private name?: string) { this._wsUrl = 'http://myurl/' +…
user1765862
  • 13,635
  • 28
  • 115
  • 220
-1
votes
1 answer

Angular: How to exclude certain param values in angular Route configuration

I am defining my route like this const routes: Routes = [ { path: ':id', component: PickUpWrapperComponent, resolve: { request: PickupRequestResolverService }, children: [ { path: '', component:…
Pawan Nogariya
  • 8,330
  • 12
  • 52
  • 105
1
2