File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
libs/mf-tools/src/lib/web-components Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -20,17 +20,20 @@ export function endsWith(prefix: string): UrlMatcher {
20
20
} ;
21
21
}
22
22
23
- export function connectRouter ( router : Router , useHash = false ) {
23
+ export function connectRouter ( router : Router , useHash = false ) : void {
24
+ let url : string ;
24
25
if ( ! useHash ) {
25
- router . navigateByUrl ( location . pathname . substr ( 1 ) ) ;
26
+ url = `${ location . pathname . substr ( 1 ) } ${ location . search } ` ;
27
+ router . navigateByUrl ( url ) ;
26
28
window . addEventListener ( 'popstate' , ( ) => {
27
- router . navigateByUrl ( location . pathname . substr ( 1 ) ) ;
29
+ router . navigateByUrl ( url ) ;
28
30
} ) ;
29
31
}
30
32
else {
31
- router . navigateByUrl ( location . hash . substr ( 1 ) ) ;
33
+ url = `${ location . hash . substr ( 1 ) } ${ location . search } ` ;
34
+ router . navigateByUrl ( url ) ;
32
35
window . addEventListener ( 'hashchange' , ( ) => {
33
- router . navigateByUrl ( location . hash . substr ( 1 ) ) ;
36
+ router . navigateByUrl ( url ) ;
34
37
} ) ;
35
38
}
36
39
}
You can’t perform that action at this time.
0 commit comments