Skip to content

Clarify Router information about resolve #18538

Closed

Description

@softchris

When defining the crisisCenterRoutes and the CrisisDetail in particular there should a be a snippet showing something like :
{
path: 'crisis-center/:id'
component : CrisisDetailComponent,
resolve : [ CrisisDetailResolver ]
}

if you only add CrisisDetailResolver to the providers array for CrisisCenterRoutingModule then resolver is not hit and it doesn't know when it should be applied. This has gone missing from the docs somehow and is quite important to understand the resolve mechanism

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

Expected behavior

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment


Angular version: X.Y.Z


Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

Activity

  1. gkalpak commented on Aug 5, 2017

    @gkalpak
    Member

    I assume you are referring the Fetch data before navigating section. The need to add a resolve property is mentioned in the text:

    Import this resolver in the crisis-center-routing.module.ts and add a resolve object to the CrisisDetailComponent route configuration.

    And the code is updated in crisis-center-routing.module.ts (as can be seen right below "The relevant Crisis Center code for this milestone follows.").

    Are you suggesting the there should be a dedicated snippet?

  2. added this to the needsTriage milestone on Feb 28, 2018
  3. modified the milestones: needsTriage, Backlog on Jun 4, 2018
  4. added
    featureLabel used to distinguish feature request from other issues
    and removed on Jun 4, 2018
  5. changed the title [-]in url https://angular.io/guide/router and headline , Resolve: pre-fetching component data[/-] [+]Clarify Router information about resolve[/+] on Jun 4, 2018
  6. brandonroberts commented on Sep 26, 2018

    @brandonroberts
    Contributor

    Fixed via #20023

  7. angular-automatic-lock-bot commented on Sep 14, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  8. locked and limited conversation to collaborators on Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions