Why isn't id
available in the below guard?
@Injectable()
export class ProjectDetailsGuard implements CanActivate {
constructor(private activatedRoute: ActivatedRoute) { }
canActivate() {
const id = this.activatedRoute.snapshot.params['id'];
console.log(id); // <-- undefined
}
}
The same code works perfectly when implemented inside components.