I upgraded my Angular code to Angular-15. Then I have this code:
REDIRECTGUARD:
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, Router } from '@angular/router';
@Injectable({
providedIn: 'root'
})
export class RedirectGuardService {
constructor(private router: Router) { }
canActivate(routeSnapshot: ActivatedRouteSnapshot): boolean | Promise<boolean> | Promise<boolean> | boolean {
this.router.navigateByUrl(routeSnapshot.data.redirectTo, {skipLocationChange: true});
return true;
}
}
Then I got this error:
Property 'redirectTo' comes from an index signature, so it must be accessed with ['redirectTo'].