File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
modules/@angular/router/src/directives Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -128,8 +128,6 @@ export class RouterLinkWithHref implements OnChanges, OnDestroy {
128128 // the url displayed on the anchor element.
129129 @HostBinding ( ) href : string ;
130130
131- urlTree : UrlTree ;
132-
133131 constructor (
134132 private router : Router , private route : ActivatedRoute ,
135133 private locationStrategy : LocationStrategy ) {
@@ -167,17 +165,17 @@ export class RouterLinkWithHref implements OnChanges, OnDestroy {
167165 }
168166
169167 private updateTargetUrlAndHref ( ) : void {
170- this . urlTree = this . router . createUrlTree ( this . commands , {
168+ this . href = this . locationStrategy . prepareExternalUrl ( this . router . serializeUrl ( this . urlTree ) ) ;
169+ }
170+
171+ get urlTree ( ) : UrlTree {
172+ return this . router . createUrlTree ( this . commands , {
171173 relativeTo : this . route ,
172174 queryParams : this . queryParams ,
173175 fragment : this . fragment ,
174176 preserveQueryParams : toBool ( this . preserveQueryParams ) ,
175177 preserveFragment : toBool ( this . preserveFragment )
176178 } ) ;
177-
178- if ( this . urlTree ) {
179- this . href = this . locationStrategy . prepareExternalUrl ( this . router . serializeUrl ( this . urlTree ) ) ;
180- }
181179 }
182180}
183181
You can’t perform that action at this time.
0 commit comments