blob: bedb3450e6b34eb980ab730749362ba6d5b45a37 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import { Injectable } from '@angular/core'
import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, RouterStateSnapshot } from '@angular/router'
import { MetaService } from './meta.service'
@Injectable()
export class MetaGuard implements CanActivate, CanActivateChild {
constructor (private meta: MetaService) { }
canActivate (route: ActivatedRouteSnapshot): boolean {
const metaSettings = route.data?.meta
if (metaSettings) {
this.meta.update(metaSettings)
}
return true
}
canActivateChild (route: ActivatedRouteSnapshot): boolean {
return this.canActivate(route)
}
}
|