Skip to main content
added 181 characters in body
Source Link

Here you can see a related github issue that also is related to angular guard (conditional) redirection.

The example solution from the github issue is (also mentioned by @David Alsh in the comments earlier):
{path: '', pathMatch: 'full', children: [], canActivate: [RedirectGuard]}

And then in the RedirectGuard's canActivate method you could use: this.router.navigate(), where this.router is the Router from '@angular/router': https://angular.io/guide/router, in order to execute the redirect.

Example use of this.router.navigate():
this.router.navigate(['/heroes']);

You can find even more details in this stackoverflow question.

Good luck!

Here you can see a related github issue.

The example solution from the github issue is (also mentioned by @David Alsh in the comments earlier):
{path: '', pathMatch: 'full', children: [], canActivate: [RedirectGuard]}

And then in the RedirectGuard's canActivate method you could use: this.router.navigate(), where this.router is the Router from '@angular/router': https://angular.io/guide/router, in order to execute the redirect.

Example use of this.router.navigate():
this.router.navigate(['/heroes']);

Good luck!

Here you can see a github issue that also is related to angular guard (conditional) redirection.

The example solution from the github issue is (also mentioned by @David Alsh in the comments earlier):
{path: '', pathMatch: 'full', children: [], canActivate: [RedirectGuard]}

And then in the RedirectGuard's canActivate method you could use: this.router.navigate(), where this.router is the Router from '@angular/router': https://angular.io/guide/router, in order to execute the redirect.

Example use of this.router.navigate():
this.router.navigate(['/heroes']);

You can find even more details in this stackoverflow question.

Good luck!

Source Link

Here you can see a related github issue.

The example solution from the github issue is (also mentioned by @David Alsh in the comments earlier):
{path: '', pathMatch: 'full', children: [], canActivate: [RedirectGuard]}

And then in the RedirectGuard's canActivate method you could use: this.router.navigate(), where this.router is the Router from '@angular/router': https://angular.io/guide/router, in order to execute the redirect.

Example use of this.router.navigate():
this.router.navigate(['/heroes']);

Good luck!