(routing) Use "corrected" behavior for relative link resolution (https://github.com/angular/angular/pull/22394) as it's the default value starting from Angular v11 (https://github.com/angular/angular/pull/25609)

This commit is contained in:
sercan
2021-05-12 12:46:01 +03:00
parent 57ba071fa5
commit a9ada174b4
13 changed files with 40 additions and 148 deletions

View File

@@ -490,22 +490,15 @@ export class TasksDetailsComponent implements OnInit, AfterViewInit, OnDestroy
return;
}
// Get the current activated route
let route = this._activatedRoute;
while ( route.firstChild )
{
route = route.firstChild;
}
// Navigate to the next task if available
if ( nextTaskId )
{
this._router.navigate(['../', nextTaskId], {relativeTo: route});
this._router.navigate(['../', nextTaskId], {relativeTo: this._activatedRoute});
}
// Otherwise, navigate to the parent
else
{
this._router.navigate(['../'], {relativeTo: route});
this._router.navigate(['../'], {relativeTo: this._activatedRoute});
}
});