1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

how to access hierarchical route resolver data in Angular

Discussão em 'Angular' iniciado por aasukisuki, Setembro 11, 2024.

  1. aasukisuki

    aasukisuki Guest

    First and foremost, here's a stackblitz of the issue I'm facing.

    Let's say I have a route in my application that looks like /projects/{projectId}/files/{fileId}.

    I have a projectResolver defined at the /projects/{projectId} route (and subsequent child routes) that will call the API and load the project data.

    I have a second fileResolver defined at the /projects/{projectId}/files/{fileId} to load the specific file from the API. However, in order to load that file, I need information defined on the project object that's resolved from the projectResolver.

    When I try to access the route, I can see the project endpoints being called, and object is resolved. However, if I try to access that project from the activatedRouteSnapshot.data in the fileResolver, the data is not present.

    Is there a way to access data from other resolvers "higher up" in the route chain?

    Continue reading...

Compartilhe esta Página