It is an interesting point. The only problem I see with this approach is the need to write an error handler inside every route resolver. That kind of makes the components lose their purpose. I believe all the user needs is to navigate back to the page where he/she came from, and for that we can make use of @angular/common's Location class.
Another approach is - (if we want to stay on the same page) - is to use { skipLocationChange: true } when we navigate to /error.
That kind of makes the components lose their purpose.
No, it's not. On the contrary, we can use the components to the fullest, because we can use the appropriate component for the error handler:
<ng-container*ngIf="!httpErrorResponse">
Current component code here
</ng-container><cst-http-errors[httpErrorResponse]="httpErrorResponse"></cst-http-errors>
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It is an interesting point. The only problem I see with this approach is the need to write an error handler inside every route resolver. That kind of makes the components lose their purpose. I believe all the user needs is to navigate back to the page where he/she came from, and for that we can make use of
@angular/common
'sLocation
class.Another approach is - (if we want to stay on the same page) - is to use
{ skipLocationChange: true }
when we navigate to/error
.No, it's not. On the contrary, we can use the components to the fullest, because we can use the appropriate component for the error handler: