Questions tagged resolver

Explore the latest questions and answers asked by our top developers.

How to refresh resolver data in Angular without navigate?

I get data from backend with Resolver. That’s ok. But how can I refresh these data on same route? For example: I have a settings page. User edit some data, then save. After that, I would like refresh data from backend. How can I "trigger" resolver, to call a new HTTP request without Router navigate? […]

By mullern
Published
Categorized as angular, http, resolver Tagged , ,

Observable never completes in Resolver

I am trying to implement a resolver so that my API data is resolved before loading a component. The observable returned from my HTTP request in my service is never completing, causing routing to hang. I have scoured tutorials and Angular documentation to see what I am doing wrong. Any ideas? I have generalized some […]

By Paul Thorsen
Published
Categorized as angular, observable, resolver Tagged , ,

In Angular 10: can I refresh data from Resolver of parent route?

I have a parent route which uses a Resolver to get data. I have several children of this route. The child Components subscribe to this data in their ngOnInit() methods. ngOnInit() { this.route.parent.data .subscribe((data: { collection: DataCollection }) => { this.collection = data.collection; }); } The Resolver only runs on the first access of one […]

By blogofsongs
Published
Categorized as angular, refresh, reload, resolver, state Tagged , , , ,

Error handling in route resolver with NgRx

I am using resolver to fetch data before the route loads. I am using NgRx effects to call API and set the state. Here’s my resolver code: resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot, nextState?: RouterStateSnapshot): Observable<any> | Promise<any> | any { p = some number return this.store.select(‘quesList’).pipe( take(1), map(queList => { return queList.pageData[p]; }), switchMap(list => { […]

By Priya Verma
Published
Categorized as angular, angular-resolver, ngrx, resolver Tagged , , ,

How to combine data returned by a resolver into a combineLatest call?

I have a resolver on a page to load the data. This resolver returns an Observable<Product[]> Then I combine the stream from the resolver with another stream using combineLatest. But the problem is when I combine the streams, I get an error that says my streams are used before being initialized. I tried to put […]

By andr marquis
Published
Categorized as angular, observable, resolver, rxjs Tagged , , ,

Angular: Iterate over nested object using resolver

I have this resolver service for my admin module: constructor(private userservice: UserService) { } resolve( route: ActivatedRouteSnapshot, state: RouterStateSnapshot ): Observable<any> { return this.userservice.getUserById(route.paramMap.get(‘id’)); } } The fethed data in a detail component export class AdminDetailComponent implements OnInit { user: any; constructor(private route: ActivatedRoute) {} ngOnInit() { this.route.data.subscribe((data:any) => { this.user=Array.of(data); console.log(this.user) }); } } […]

By Mellville
Published
Categorized as angular, render, resolver Tagged , ,

Angular resolve only if user is authorised

I want the resolver to only go through if the user is authorised. I have manager and standard level access. The JWT token has a role claim which then says if the user is a "Manager" or "Standard" account. If I log in as manager I get no problems, which is expected. When I log […]

By GolfBravo
Published
Categorized as angular, angular-resolver, resolver Tagged , ,

Angular prepopulate data for couple of fields using Resolver, resolver will return an Observable inside subscriber

In my Angular (8) application want to prepopulate couple of fields from service (DB). use case: want prepopulate Address, Apartrment etc from DB, against respective pin/zip code.and getting this zip code from another service I tried to use Resolver Router: const routes: Routes = [ { path: ‘my-form’, component: MyFormComponent, resolve: { managers: ManagerResolver, locationTrack: […]

By Manu
Published
Categorized as angular, observable, resolver, rxjs, subscribe

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq