Questions tagged [angular-activatedroute]

118 questions
0
votes
0 answers

Angular - Displaying activated route data from an imported component inside a child component

Below is my module structure: - Albums-List - Other Module - Component 1 Landing - Component 2 in child route Component two is displaying the albums list Albums List Component I have a component that obtains the route params to pass to a…
Haven
  • 87
  • 1
  • 9
0
votes
1 answer

Mock Activated Route With Params in Angular

Question How to mock ActivatedRoutes in my unit tests? Service: constructor( private route: ActivatedRoute, private knowledgeModelService: KnowledgeModelService ) { route.params.pipe(map(p => p.modelId)).subscribe((modelId) => { …
Andi Giga
  • 3,744
  • 9
  • 38
  • 68
0
votes
0 answers

Angular injecting ActivatedRoute param to service

I'm trying to pass string argument from component to a service constructor. In case of static value it was easy: @Component({ selector: 'app-board', templateUrl: './board.component.html', styleUrls: ['./board.component.css'], …
0
votes
1 answer

Actived Route is undefined in service's constructor

There is a service trackUrlService which is imported to CoreModule export class TrackUrlService implements OnDestroy { ... constructor(private router: Router, private route: ActivatedRoute) { ... this.subs.add( …
0
votes
1 answer

detect which are the origin location of user

Let's suppose we have an application with a router configured as follows: export const routes: Routes = [ { path: 'supply', component: SupplyListComponent }, { path: 'supply/:id', component: SupplyComponent } ]; Each supply can…
Aw3same
  • 930
  • 4
  • 13
  • 38
0
votes
1 answer

Angular 7: ActivateRoute catch paramId get null value

I want to subscribe to my praramID when page load but I try console.log() it's returning null. I am using Angular 7. This is my typescript: import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from…
Adam
  • 351
  • 1
  • 4
  • 15
0
votes
2 answers

ActivatedRoute is showing null

trying to get the data from router in different component. but its showing {} value. app-routing.module.ts { path: '', loadChildren: './pages/pages.module#PagesModule', }, pages-routing.module.ts path: 'namescan', component:…
0
votes
3 answers

How to get Router params when using pipe in combination with skipWhile?

I have a dynamic BreadCrumb navigation where I need to get the params from URL. To achieve this, I'am executing the following code: const userId = this.activatedRoute.params .pipe(skipWhile((params: Params) =>…
k.vincent
  • 3,743
  • 8
  • 37
  • 74
0
votes
1 answer

Hide query parameters after parsing them in my url

my frontend is in http://host:4200 and when the other frontend wants to open it for example with window.open(http://host:4200?username=a&department=b) so this http://host:4200?username=a&department=b will be in the address bar, How can I remove…
Fariba
  • 693
  • 1
  • 12
  • 27
0
votes
0 answers

How can i read special characters from a URL parameter as characters and not as ASCII code

I have these asp.net reset password generated code in the…
0
votes
0 answers

Why does "Angular Material Tabs" active only the other one on Ionic 4?

I'm newbie with Ionic 4. I integrate Angular Material into my Ionic 4 project. I have problem with Angular Material - Tabs & Navigation. After I switch 2 tabs about 2 - 3 times, the tab just active the other one. I check HTML code, and I see problem…
0
votes
1 answer

activated route optional parameter observable emitting each character instead of entire string

I have a method in an angular component whose content is : this.route.paramMap.pipe( switchMap((params: ParamMap) => { let fooValue = params.get('selectedid'); console.log("inside switch map with value as " + fooValue); return…
user2599052
  • 1,056
  • 3
  • 12
  • 27
0
votes
1 answer

Error as Cannot read property 'subscribe' . for activated route in angular 7 while unit testing

I am getting error as Cannot read property 'subscribe' of undefined for activated route in angular 7 while unit testing .I have tried it in multiple way kindly help . Observer.of is not working for me as i have rx.js version 6.3.3 here is my…
0
votes
3 answers

Get data from another component in the route tree

For example you have the components A, B and C and this route direction: A -> B -> C I can retrieve data from the previous component (got to C and get data from B) with these lines: Component C: private _activatedRoute:…
B0r1
  • 400
  • 3
  • 15
0
votes
1 answer

Unable to trigger ngOninit and route.params upon redirection using RouterLink

I'm trying to redirect from one page to another using routerLink, but the redirected link doesn't trigger the ngOnInit() method as well as the ActivatedRoute subscription. The redirected page then freezes but there is no error on the console. So…
Jin
  • 162
  • 2
  • 14