blob: 851404959ca1dd65be2a9d0f14aaf74fc9fd7c0f (
plain) (
tree)
|
|
import { Injectable } from '@angular/core'
import { ActivatedRouteSnapshot, CanActivate, CanActivateChild } 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)
}
}
|