File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,24 @@ export class LoginComponent {
115
115
116
116
Both options provide the same navigation mechanism, just fitting different use cases.
117
117
118
- > A note on navigation with relative URLs: Currently, to support multiple navigation stacks, relative URLs are something not supported
118
+ And we also can use navigate relative URLs by ` ActivatedRoute ` and ` relativeTo ` .
119
+
120
+ ``` typescript
121
+ import { Component } from ' @angular/core' ;
122
+ import { ActivatedRoute , Router } from ' @angular/router' ;
123
+
124
+ @Component ({
125
+ ...
126
+ })
127
+ export class LoginComponent {
128
+
129
+ constructor (private router : Router , private route : ActivatedRoute ,){}
130
+
131
+ navigate(){
132
+ this .router .navigate ([' /detail' ], { relativeTo: this .route })
133
+ }
134
+ }
135
+ ```
119
136
120
137
## Lazy loading routes
121
138
You can’t perform that action at this time.
0 commit comments