make only accessible for Admin in Website with Angual

You have to use canActivate in your routes definition.

  imports: [
        path: 'team/:id',
        component: TeamComponent,
        canActivate: [AuthGuard]

You can create custom conditions as AuthGuard:

export class AuthGuard implements CanActivate {

  ) {}

  canActivate() {
    if (somthing) {
      return true;
    } else {
      return false;

Check the documentation

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top