123456789101112131415161718192021222324252627 |
- import { Injectable } from '@angular/core';
- import { CanActivate, Router } from '@angular/router';
- @Injectable({
- providedIn: 'root'
- })
- export class SpecimenView2Guard implements CanActivate {
- constructor(public router: Router) { }
- canActivate(): boolean {
- let menus = JSON.parse(localStorage.getItem('menu'));
- let can = false;
- if (menus) {
- menus.forEach((e) => {
- if (e.link == 'specimenView2') {
- can = true;
- }
- });
- }
- if (!can) {
- this.router.navigate(['login']);
- return false
- }
- return true;
- }
- }
|