Questions tagged [angular-activatedroute]
118 questions
0
votes
0 answers
How to mock activatedRoute.data in angular for getting data?
I am reading data from the activatedRoute.data as below
Not able to mock the ActivatedRoute.
Please some one suggest me.
import { BehaviorSubject } from "rxjs";
export class MockActivatedRoute {
data: BehaviorSubject;
constructor(){
…

user8260229
- 1
- 1
0
votes
0 answers
angular url parameter fails to fetch without url ending in #
I have an angular app and trying to get url parameters. The router config is like below
export const appRoutes: Routes = [
{ path: '', component: SharepointMainComponent },
{ path: 'userProfile' ,component: UserDataComponent, canActivate :…

Vik
- 8,721
- 27
- 83
- 168
0
votes
1 answer
Getting data for route resolver by making http requests such that the result of second one depends on the result of first one
I have a resolver in my routing module
{
path: 'path1',
component: FirstComponent,
resolve: {
allOrders: DataResolver
}
}
And then in my resolve function there is
resolve(): Observable> {
return…

tritims
- 52
- 1
- 6
0
votes
2 answers
TypeError: Cannot read property '0' of undefined when reading params of ActivatedRoute - Angular 6 testing in Jasmine/Karma
I'm trying to test a component that reads the Id param from the Activated route, currently my goal is to get the component to render correctly but I can't figure out why the test fails.
I have passed the ActivatedRoute in the same way for a similar…

Oscar Fredriksson
- 1
- 1
- 1
0
votes
0 answers
Angular takes URL parameters and write them in input field
I have a system where I have a change password component.
The problem here is that my URL parameters from resetPW go into the first input field.
when i load the page the params from reset goes into the first input field
This is my…

Thomas Staal
- 23
- 8
0
votes
3 answers
Using ActivatedRoute to Load Data on Return to a Component in Angular App
I am trying to get my activatedRoute in my Angular app, so that I can load this within the onInit life cycle hook, so that when a user returns to a component, the component will load with the state of the url as they last left it.
I have already…

Muirik
- 6,049
- 7
- 58
- 116
0
votes
2 answers
Fetching query parameters from HTTP get/post in angular 4 service
I'm trying to send form data using the following HTML form :-

codechefvaibhavkashyap
- 965
- 19
- 32
0
votes
2 answers
ActivatedRoute in Angular 5 not delivering URL parameters. Ideas?
I have implemented ActivatedRoute on my app.component.ts page. This is the page where I have a big, red exit button on, and it appears on all pages of my app as intended.
I jump into the url I've created (with a query string) as…

Vinnie Saletto
- 329
- 2
- 5
- 20
0
votes
2 answers
Check current component after timeout
I'm in a component called "recoger_success" and I want it to navigate to the home component after 10 seconds after clicking a button that has countdown() linked to it. The problem is that if I navigate to another component before the timeout gets to…

Alex
- 75
- 10
0
votes
1 answer
Angular dynamic array showing all results not just data under id
I am still trying to learn what seems to me like advanced Angular 5. The below code does enter the "id" number from the array into the url as expected, but when I go to model/1 it shows my all the objects from the array. I need to only see the…

RyanIndustries8
- 157
- 3
- 16
0
votes
0 answers
Angular send an different type (enum) in the url when using routerLink
I have a button which has an routerlink.
On the "routedpage" there is an enum which decides what will be loaded on the page.
I like to send a param with the button so I can use it on the routed page.
List of…

Babulaas
- 761
- 3
- 13
- 47
-2
votes
2 answers
Angular 8 sending an array with the navigate() is returning an object instead of the array itself
I want to send an array of data within the .navigate() of angular 8 routing module.
At the home component, the result of:
console.log(this.offers)
Is returning all available offers with all their related data.
After that, I am sending this.offers…

alim1990
- 4,656
- 12
- 67
- 130
-2
votes
1 answer
Angular's ActivatedRoute to use same component for 'new' and 'edit'
I don't fully understand how to use the ActivatedRoute service. In my application the code to create or edit a user is exactly the same with the only difference being that an "edit" first queries for the current values from a webservice whereas the…

Gargoyle
- 9,590
- 16
- 80
- 145