File tree 1 file changed +5
-2
lines changed
packages/angular/ssr/src/utils
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import {
20
20
platformServer ,
21
21
ɵrenderInternal as renderInternal ,
22
22
} from '@angular/platform-server' ;
23
- import { Router } from '@angular/router' ;
23
+ import { ActivatedRoute , Router } from '@angular/router' ;
24
24
import { Console } from '../console' ;
25
25
import { joinUrlParts , stripIndexHtmlFromURL } from './url' ;
26
26
@@ -98,10 +98,13 @@ export async function renderAngular(
98
98
99
99
// TODO(alanagius): Find a way to avoid rendering here especially for redirects as any output will be discarded.
100
100
const envInjector = applicationRef . injector ;
101
+ const routerIsProvided = ! ! envInjector . get ( ActivatedRoute , null ) ;
101
102
const router = envInjector . get ( Router ) ;
102
103
const lastSuccessfulNavigation = router . lastSuccessfulNavigation ;
103
104
104
- if ( lastSuccessfulNavigation ?. finalUrl ) {
105
+ if ( ! routerIsProvided ) {
106
+ hasNavigationError = false ;
107
+ } else if ( lastSuccessfulNavigation ?. finalUrl ) {
105
108
hasNavigationError = false ;
106
109
107
110
const { finalUrl, initialUrl } = lastSuccessfulNavigation ;
You can’t perform that action at this time.
0 commit comments