File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
packages/angular/ssr/src/utils Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import {
2020 platformServer ,
2121 ɵrenderInternal as renderInternal ,
2222} from '@angular/platform-server' ;
23- import { Router } from '@angular/router' ;
23+ import { ActivatedRoute , Router } from '@angular/router' ;
2424import { Console } from '../console' ;
2525import { joinUrlParts , stripIndexHtmlFromURL } from './url' ;
2626
@@ -98,10 +98,13 @@ export async function renderAngular(
9898
9999 // TODO(alanagius): Find a way to avoid rendering here especially for redirects as any output will be discarded.
100100 const envInjector = applicationRef . injector ;
101+ const routerIsProvided = ! ! envInjector . get ( ActivatedRoute , null ) ;
101102 const router = envInjector . get ( Router ) ;
102103 const lastSuccessfulNavigation = router . lastSuccessfulNavigation ;
103104
104- if ( lastSuccessfulNavigation ?. finalUrl ) {
105+ if ( ! routerIsProvided ) {
106+ hasNavigationError = false ;
107+ } else if ( lastSuccessfulNavigation ?. finalUrl ) {
105108 hasNavigationError = false ;
106109
107110 const { finalUrl, initialUrl } = lastSuccessfulNavigation ;
You can’t perform that action at this time.
0 commit comments