Questions tagged [angular-resolver]

135 questions
67
votes
7 answers

Why would you use a resolver with Angular

I like the idea of resolvers. You can say that: for a given route you expect some data to be loaded first you can just have a really simple component with no observable (as retrieving data from this.route.snapshot.data) So resolvers make a lot of…
maxime1992
  • 22,502
  • 10
  • 80
  • 121
38
votes
8 answers

Resolver Emitting Error ` ERROR Error: "[object Object]" `

I'm having a problem with regards of implementing a resolver on my routes as it has no issue until I include InitialDataResolver on my routing module. pages-routing.module.ts import { NgModule } from '@angular/core'; import { Routes, RouterModule…
Riyenz
  • 2,498
  • 2
  • 9
  • 23
14
votes
2 answers

Angular resolver not updating or refetching data, despite `runGuardsAndResolvers` set to 'always'?

I have a set of Angular routes, with a listing of entities, with two child routes for creation of such an entity and the editing of an existing entity. The listing of entities has a resolver attached to it to prefetch the data for the component…
marked-down
  • 9,958
  • 22
  • 87
  • 150
13
votes
3 answers

CanActivate guards on child routes run before parent Resolve finish

I'm trying to resolve data before navigating to children routes as i have to use that data in children guard. The issue is parent resolver, resolves data after the child guard is fired. Resolver takes long time to resolve data // app.module.ts const…
12
votes
2 answers

Angular 2+ - data loading: best practices

I was wondering what the best approach is to load data in Angular 5. Of course, we want to keep components dumb ;) For now, I am using a resolver and Angular calls the resolver in a specific route. Basically, data is loaded before a component has…
GuyT
  • 4,316
  • 2
  • 16
  • 30
10
votes
2 answers

resolver on lazy loading angular

is there a way to add a resolver before loading a lazy load module? i tried to add resolve to the routs configuration but it is not triggered, also didn't find any thing useful about it on the web. any help would be appreciated import { NgModule }…
omer
  • 2,435
  • 2
  • 24
  • 28
8
votes
1 answer

i get resolve as strikethrough in my angular 15 generated project. how can i solve this?

I'm really new to angular and this is the first project I'm creating. what I need to do here is create an add-editClient component and use the angular resolve method to get data from the backend which is spring-boot and for the database I use MYSQL…
codinggirl23
  • 81
  • 1
  • 3
6
votes
4 answers

data is not updating on page after routing to same url with different params

Basically I have a notification component that show notification on click of icon in header. When we click the icon on header, it opens a popup and shows a list of notification. On clicking any one of the notification, it routes the user to the…
Rohit Kumar
  • 61
  • 1
  • 2
6
votes
2 answers

Router Resolver not rendering component

I have this router resolver to retrieve data from the Google Firestore. I am trying to use the Resolver to fetch the data ahead. When I place debugger at resolve function it shows me the data retrieved from the Server. But it is never returning from…
PopStack
  • 171
  • 1
  • 8
5
votes
1 answer

Angular 8 route resolver not canceling route navigation when return EMPTY

I'm adding an Angular 8 route resolver to prefetch data. Upon failure (for any reason) I return an EMPTY to cancel the route navigation. However, when I test this, I can step into the catchError block, it shows the toaster, and it returns EMPTY, but…
flyboy78
  • 81
  • 1
  • 7
5
votes
0 answers

Angular 4+. Show spinner while resolvers is process

Is it possible to show spinner instead of an empty page while resolvers do some work? I have a module with two resolvers: const routes: Routes = [ { path: '', component: MyComponent, canActivate: [MyAuthGuard], resolve: { …
No_Com
  • 63
  • 1
  • 5
4
votes
1 answer

Angular Universal - TypeError: Converting circular structure to JSON

I am having a big problem related to Angular Server-Side Rendering (SSR), the usage of Resolvers and HTTP requests. I am building a project in Angular 13, but I decided to implement SSR in order to improve the experience with SEO and redirection in…
4
votes
0 answers

Angular skipLocationChange doesn't work with resolver

I am using a resolver resolve: { deviceView: DeviceViewResolverService } , in order to get all necessary data for my component before it is initialized. I also use highcharts and if I call the same URL but want to get a different data from…
Alon
  • 41
  • 4
4
votes
1 answer

How to use Angular Resolver for a component without route config?

I am using Angular Resolver to prefetch data from the server before showing the route so a page is not loaded empty, we're Ok about this principle. My question now is how to use the same Resolver to prefetch data from server without a route ? To…
Ghassen
  • 591
  • 1
  • 15
  • 33
4
votes
1 answer

Angular GlobalErrorHandler and HttpErrorResponse - Resolver throwing badly formatted HttpErrorResponse

I've created global error handler in my Angular 6 application: main error handler method: handleError(error: Error | HttpErrorResponse) { const router = this.injector.get(Router); const notificationService =…
1
2 3
8 9