145 questions
2
votes
2
answers
169
views
How to use an Angular Route Title Resolver to wait on an observable?
I have an Angular 19 app and I am trying to add a route title resolver that gets the page title by looking up some data in the results of an Observable.
The issue is that when the app first loads, the ...
2
votes
1
answer
65
views
How does the Angular resolver handle subscriptions?
I am using an Angular resolver to load initial Data of my page. As known it is possible to either return an observable or a promise.
In my case I have this:
export class MySiteResolver implements ...
1
vote
0
answers
50
views
"At least one route resolver didn't emit any value" Navigation error on parent route resolver (Angular)
I have an inconsistent navigation issue when authenticating on my website. On authentication from the login page, there is a navigation to the home page (auth only).
On occasion, the navigation fail, ...
1
vote
1
answer
80
views
Facing Angular resolver error after fixing "Cannot Get" problem
Not a long ago I've deployed my project. Only after deploying I realized that I have this "Cannot GET" problem when refreshing my page:
Cannot GET / on page refresh with express
I've fixed ...
1
vote
0
answers
140
views
Angular: Guard after resolved data
I'm having a route /invoices/:invoiceId for an invoice detail view which needs to be protected with 2 conditions
User needs to be authenticated --> Redirect to login page
Invoice with given id ...
1
vote
1
answer
84
views
Angular resolvers that return observables, only wait for the first value
Before all my components are rendered, my app needs some basic data that has to be available to all components.
Therefore I wrote a resolver that returns an observable.
export const appRoutes: Route[] ...
0
votes
0
answers
68
views
How to apply declarative RXJS in Angular for route resolvers
I'm interested in adapting the following code for route resolvers.
private categorySubject = new Subject<number>();
categorySelectedAction$ = this.categorySubject.asObservable();
...
1
vote
1
answer
611
views
Angular 17 Functional Resolver Unable to Inject Services Into Jest Test Case
Overview
Hi there,
I am in the process of migrating my Angular app from v14 to v17, and one of the tasks that comes with this is replacing the old deprecated Resolver classes with the new ResolverFn ...
2
votes
1
answer
453
views
How to handle stored query params in angular route using resolvers to avoid any extra navigation?
I have this scenario: I am saving the query params in a service in order to keep alive this data if the user close the browser, using the resolvers I am using the result from the active route to add ...
1
vote
1
answer
139
views
Prevent resolver from making additional calls if another resolver called and then redirected to different path
My app tries to auto-redirect user from '/' to correct other path. To do that we need to make a request for some data and only then decide where to redirect the user. The options are just a few, and ...
0
votes
2
answers
310
views
Can a resolver use the same service instance form another module except the AppModule in Angular?
I have a lazy loaded module with all it components declared and routes added in RouterModule.forChild()
but some of these routes have their resolver that will prefetch some data And call a service to ...
-1
votes
1
answer
725
views
Angular 16 Resolvers - How to handle redirection to child
I'm just really looking for some general advice on best practice here as it's the first time I've had to use resolvers.
So the current flow of my application...
App initialisation function to check ...
1
vote
2
answers
1k
views
How do I run a http request using a functional resolver?
In the past I can use a class based resolver where I can inject HttpClient in the constructor, but that's been deprecated Source.
I'd like to make an HTTP get request in a functional resolver. How do ...
4
votes
1
answer
4k
views
Angular ResolveFn - inject() must be called from an injection context
While attempting to deprecate instances of Angular's "Resolve" class implementation for the preferred functional implementation "ResolveFn", I ran into a perplexing issue.
I have a ...
0
votes
0
answers
2k
views
How to convert deprecated resolver using Resolve interface to use the ResolveFn syntax?
[SOLVED]
Original :
export enum RecipeActions {
SET_RECIPES = '[RECIPES] SET_RECIPES',
FETCH_RECIPES = '[RECIPES] SET_RECIPES', // MISSED THIS
ADD_SINGLE = '[RECIPES] ADD_SINGLE',
ADD_MULTI = '...
2
votes
2
answers
3k
views
How to proper implement an Angular Resolver using NGRX
I have been playing around with NGRX for the couple last days.
I'm following an Udemy course, and at some point in the course the teacher makes a resolver to prefetch some data into the ngrx store ...
14
votes
1
answer
18k
views
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 ...
1
vote
1
answer
511
views
Load data before component renders Angular
I am trying to load the data for places before the component renders.
dashboard.html
{{ places[0]._id }} //just for testing
dashboard.ts
import { Component, OnInit } from '@angular/core';
import { ...
2
votes
1
answer
1k
views
"Unable to resolve dependency tree" while creating a new Angular project
I am new to coding, and I want to start using Angular on my M1 MacBook.
The installation of Angular cli was only somewhat successful, as I got this warning after typing sudo npm install -g @angular/...
0
votes
2
answers
603
views
Angular Resolver does not hit API when reloading the page?
I've used resolver for one of my component. when navigate from component to route it works fine. but when I reload the page it does not hit API. it gives me the uncaught error.
This my list
when i ...
1
vote
1
answer
555
views
Angular Router not Resolving Promises before returning observable
I have a resolver which uses the url to fetch the parent called a bubble, for the reply that I then want to fetch based on the URL.
Problem is that my findReplyByUrl() function wont wait for the DOCID ...
2
votes
3
answers
3k
views
How to conditionally update Angular route resolver data?
I've got an Angular route resolver that has a list of items that gets loaded when my parent route gets loaded, like /users. I have implemented an Angular resolver that looks more or less like this:
...
0
votes
0
answers
100
views
How to handle http requests from ngrx/effects in a route resolver?
I'm writing an angular app in which it initially sets an array of movies into my app state. I do this via a Ngrx action and get the movies through a http request in the relative effect to that action. ...
0
votes
1
answer
480
views
Execute Resolvers in Route Hierarchy in Parallel in Angular?
With a hierarchical route structure, I would like to get the resolvers along a particular branch to execute in parallel.
The Setup
Currently I have my routing setup like this:
app-routing.module.ts:
...
-1
votes
1
answer
703
views
How to use forkJoin and mergeMap in Angular resolver to chain HTTP requests?
I am building a resolver that is used when my app loads initially. I need to run several HTTP requests, which can be run at the same time (hence using forkJoin). But there are a few that need to be ...
0
votes
1
answer
437
views
Get loaded component in parent resolver
I'm trying to access the component's name in parent resolver, but it is always undefined. It might be a limitation of the angular router, a not implemented feature, or an intentional behaviour, ...
1
vote
0
answers
762
views
Angular 12: Resolve guard redirects to its current component instead of navigating to its destination
When you log in you should be redirected to the dashboard page. When we navigate to the dashboard we are going to do a resolve so that the data is already loaded even before we can see the page. When ...
4
votes
1
answer
705
views
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 ...
0
votes
1
answer
429
views
Issue Loading Dynamic Templates into Text Editor (TinyMCE) via Angular Resolver
I am attempting to inject dynamic templates into my tinyMCE configuration prior to loading the element. The reason for this is because I want my users to save templates on their own and be able to ...
0
votes
1
answer
785
views
Angular - How to share a service provided in component with the component's resolver?
I have a messenger component, with a messages service provided in the component itself (as it needs to be component specific) as such:
@Component({
selector: "app-messenger",
templateUrl:...
0
votes
0
answers
142
views
HttpClient request in loop Angular Resolver
I have my resolver.ts
return this.wardrobeStateServ.init(this.categoryIndexes).pipe(take(1),
map((value) => value));
and my init function
init(categoryIndexes: number[]): Observable<...
0
votes
3
answers
1k
views
Angular 12 + Ionic 5: Resolver does not wait for the Storage and HTTP calls to finish
SITUATION:
This question is regarding a SPA that I am building using Angular 12 and Ionic 5. When I am on the Home page, I can click the "Order History" link in the Side Menu and this routes ...
0
votes
2
answers
3k
views
Angular resolver inject router
I defined a resolver in my Angular (v13) app to do some shenanigans with a wordpress backend. When the user accesses an URL I want the resolver to check post type and ID from wordpress and route ...
0
votes
0
answers
634
views
Call API/Resolve page before Refresh in Angular
when I refresh page(f5) for a moment footer is just coming to top, then page is loaded.
I am using resolver for load data from api. When I route from another component everything works as expected, ...
1
vote
1
answer
328
views
Angular: routing resolver placement
Does it matter where the resolver exists in Angular in these two examples? Both of these two snippets of code achieve the same result:
Placing the resolver at the module-level within AppModule:
const ...
1
vote
1
answer
722
views
how to spy on Rxjs operators like 'take'
@Injectable({
providedIn: 'root'
})
export class MyResolver implements Resolve<LoggedUserProfile> {
constructor(private readonly _store: Store<AppState>) {}
resolve(
route: ...
0
votes
1
answer
1k
views
Angular - Get data from a particular component instance in order to be able to interact with it via a button click
I have a status box which is it’s own component. On my app there are multiple instances of this status box component as you can see from the image below:
The details of each status box are stored in ...
2
votes
1
answer
2k
views
How resolvers work with SSR and Angular Universal
I am new to ssr and Angular universal and i have a question i didn't found an answer to.
I wanted to know if it was possible, for pages with route resolve in Angular, to be rendered by the ssr server ...
0
votes
1
answer
123
views
Angular 6+ resolver doesn't load video url
I am trying to load a video url after the data be loaded from the server. I am using a resolver but it doesn't work because the video is loaded before the data some times. What I am doing wrong?
...
1
vote
0
answers
312
views
Angular resolver nested object value undefined
I have a resolver that seems to "lose" data when I'm using it.
The resolver's task would be to get the download url for the banner and thumbnail (if there was one) for the given stack as if ...
-1
votes
2
answers
607
views
how can i pass queryparams to my resolver
here is my ngOnInit in my component -
ngOnInit() {
this.route.queryParams.subscribe(
(params) => {
console.log(params);
}
)
}
here is my resolver -
class ...
1
vote
1
answer
2k
views
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<...
0
votes
2
answers
827
views
Is there a way that I can conditionally return an HTTP response?
I'm using a resolver to get information to populate my website. And I want to test the connection to the API to get the information so that if I don't get a response, I can call a local set of mocked ...
0
votes
0
answers
160
views
How do you reload the current route with route resolvers in Angular 11
How do you reload the current route (with route resolvers) in Angular 11 without using window.href or navigateByUrl?
I just want to re-run the route resolvers.
0
votes
1
answer
2k
views
Angular Route Param not resolving
Angular is not resolving my route parameter and I don't understand why.... GAH.
This is my routes file for the lazy module;
import { NgModule } from '@angular/core';
import { RouterModule, Routes } ...
0
votes
1
answer
299
views
Getting ResolverFactory injection issue when injecting resolver
Consider myself as a newbie. I have created my own Resolver class and trying to inject it in my feature module. But it is throwing me following error:
core.js:4352 ERROR Error: Uncaught (in promise): ...
0
votes
1
answer
1k
views
Correct way to Fetch/Pass values in a Resolver | Angular 10/11
So, I'm trying to get this data into a component before it begins to load so I can set some things before the view loads. But I'm confused as to how this resolver works, what it returns and how to ...
0
votes
1
answer
966
views
Resolver is not returning Data in Angular
I am new in Angular. I am trying to use resolver in my code. I have define routes for using resolver.
Here is my routing.
{
path: '',
component: AppComponent,
resolve: {
post: ...
0
votes
1
answer
2k
views
Angular Resolver not working no provider for ()
I have this issue in a new project.
I have created a route:
const routes: Routes = [
{
path: '',
component: CategoriesComponent,
},
{
path: ':categoryId',
...
1
vote
1
answer
1k
views
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-...