• Home
  • Jobs
  • Courses
  • Questions
  • Teachers
  • For business
  • ES/EN

0

39
Views
using Angular i want to add an admin page in my app

Hi am developing a angular app having three components all of them have a curd operations i want to add an admin page in app to restrict some users to do some of these operations using toggle button or on/off button.Img is attached I want some thing same like image.ThanksImg link

about 2 months ago ·

Juan Pablo Isaza

1 answers
Answer question

0

To restrict access to a page, you can add a guard to the certain route. To do this you should add canActivate option and provide an array of guards that should be called when you go to the route.

To create a guard you can use angular cli and run ng generate guard [name] There should be canActivate method inside the guard. For example,

  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
    if (this.authService.isAuthorized()) {
      return true;
    }

    this.router.navigateByUrl('/dashboard');
    return false;
  }
about 2 months ago · Juan Pablo Isaza Report
Answer question
Find remote jobs
Loading

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2022 PeakU Inc. All Rights Reserved.