Questions tagged [angular-resolver]

135 questions
1
vote
1 answer

type 'string | null' in not assignable to my enum

there in my ProductGender enum - enum ProductGender { Men, Women, } my getProducts service - public getProducts( gender: ProductGender, category: ProductCategory ): Observable { return…
1
vote
1 answer

Use generics in Angular route

I want to know if it's possible to use (Typescript) generics in a Angular Route, in any way possible. Best way would be if I could use generics with the component itself: // the route: { path: 'user-a', component: UserComponent // other…
BigJ
  • 1,990
  • 2
  • 29
  • 47
1
vote
1 answer

angular - guards does not wait for parent resolvers to complete

My router is like this const routes: Routes = [{ path: '', canActivate: [AuthGuard], resolve: { user: UserResolver, }, children: [{ path: 'home', canActivate: [HomeGuard], component: HomeComponent, }, { …
1
vote
1 answer

angular - Is it possible to call parent resolver each time the page is being reloaded?

In resolver: Fetch data build router depending of those data Afterwards, my router looks this: { path: '', component: WrapperComponent, resolve: { traveler: TravelerResolver, // <-- the resolver adds children }, children: [{ …
Yoann Picquenot
  • 640
  • 10
  • 26
1
vote
1 answer

angular: At least one route resolver didn't emit any value and so page not loading all times

I am facing an issue in my angular page that sometimes my page is not loading. I have enabled tracing in routes and observed that in NavigationCancel event, it throws an error reason: My route resolver is given below @Injectable() export class…
Viswa
  • 745
  • 10
  • 30
1
vote
1 answer

How to prevent a resolver from calling the same multiple http get requests

My app has several routing re-directions that each on of them triggering the FooResolverService, and each resolve invocation calls a FooService's method of GetFoos http get method (so my resource api is being requested multiple times with the same…
Shahar Shokrani
  • 7,598
  • 9
  • 48
  • 91
1
vote
0 answers

Angular 9: resolver and service on the same component

I have a service from which I get the list of the students from my backend with this simple function students-service.ts getStudents(): Observable { return this.httpClient.get(this.studentsUrl,…
1
vote
2 answers

Angular 8 Resolver - How to get data from one resolver as an input to other resolver?

I have 2 REST API. Data from both API is required. At the same time 2nd API takes input from API 1 as a parameter. GET api/one --> {id: 3}, this response id is required in GET api/two?inputFromApiOne=3 --> {name: 'SS'} My final response…
1
vote
2 answers

Make Angular resolver wait for images

What can I do to make resolver wait until it gets images from the API. Right now, Angular waits until data is received, shows page and then tries to get images of the post. @Injectable() export class DataResolverService implements Resolve { …
Fanalea
  • 181
  • 1
  • 2
  • 18
1
vote
2 answers

Angular navigate to the same component more then one time

I am trying to navigate to the same route by using [routerlink] at the nav bar. since in angular, redirect in to the same component to invoke ngOnint is not possible i faced this problem. navigation at the nav…
Charuka Herath
  • 328
  • 4
  • 20
1
vote
3 answers

Angular router.navigate doesn't route to resolver if on same component

I perform my searching from the navbar component at the top of the page. I can route to my 'member' component page when entering the search criteria from the navbar, but once I'm on the 'member' component and I change the query params and try to run…
chuckd
  • 13,460
  • 29
  • 152
  • 331
1
vote
1 answer

Purpose of returning an Observable from a Resolver in Angular

Why would one return an Observable from a resolver in Angular? How is this different than simply subscribing to a method in a service/store in the component itself? I thought a resolver's purpose is to ensure the data is present before the component…
cyberguy
  • 233
  • 3
  • 10
1
vote
1 answer

Is it a good practice to use a route resolver to pass static data to a route component in Angular 8?

We have a User component that receives a user object as an @input: export class UserComponent implements OnInit { @Input() user: User; constructor() {} } Here the corresponding template:
1
vote
1 answer

Angular implementing a genetic resolver

Been trying to implement a genetic resolver in my app for a while now. My first implementation based on my intuition gave me the exact result as this SO question: How to provide a service that uses generics in Angular4?, which of-course also gave me…
Ravid Goldenberg
  • 2,119
  • 4
  • 39
  • 59
1
vote
1 answer

How can I route to a child route based on the resolved route data?

I'm loading a module with data from the resolver. The loaded module has the usual empty-path redirect to the first child route. But I want to redirect to a specific route based on the resolved data. In the current example I have a child module with…
Benjamin Ifland
  • 137
  • 1
  • 10
1 2 3
8 9