Repository navigation
Description
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[ ] Feature request
[x] 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
[ ] Other... Please describe:
Current behavior
I am trying to figure out how to cancel a navigation request from a Resolve. For example, if the resolver is requesting data from server and server returns an error, I want to cancel the navigation. Looking at the documentations https://next.angular.io/api/router/Routes, https://next.angular.io/api/router/Resolve and https://next.angular.io/tutorial/toh-pt5, I couldn't find any solution to that.
After searching a lot, I found out that returning empty observable cancels the navigation. But it is not documented anywhere.
Expected behavior
The behavior of Resolve should be documented. It should clearly state what happens on error and how to cancel navigation.
Minimal reproduction of the problem with instructions
- Check the 'okay' router link. Resolver for the url returns a
Observable.of()value, so navigation to that url works as expected. - Check the 'error' router link. Resolver for the url returns a
Observable.empty()value, so navigation to that url does not work.
What is the motivation / use case for changing the behavior?
Make it clearer for users.
Environment
Angular version: v6.0.0-rc.6
Browser:
- [x] Chrome (desktop) version XX
- [x] Chrome (Android) version XX
- [x] Chrome (iOS) version XX
- [x] Firefox version XX
- [x] Safari (desktop) version XX
- [x] Safari (iOS) version XX
- [x] IE version XX
- [x] Edge version XX
Activity
djleonskennedy commentedon May 3, 2018
@ienzam Guards might help you
ienzam commentedon May 7, 2018
@djleonskennedy Guards have different purpose than resolve, and also I think resolve happens after guard.
brandonroberts commentedon Sep 26, 2018
Fixed via #20023
angular-automatic-lock-bot commentedon Sep 14, 2019
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.