16 lines
588 B
TypeScript
16 lines
588 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import {ActivatedRouteSnapshot, RouterStateSnapshot, CanDeactivate} from '@angular/router';
|
|
import { Observable } from 'rxjs/Observable';
|
|
import {EditTaskComponent} from "./edit-task.component";
|
|
|
|
@Injectable()
|
|
export class EditTaskGuard implements CanDeactivate<EditTaskComponent>{
|
|
|
|
canDeactivate(component: EditTaskComponent,
|
|
route: ActivatedRouteSnapshot,
|
|
router: RouterStateSnapshot)
|
|
: Observable<boolean> | boolean {
|
|
return component.canDeactivate();
|
|
}
|
|
}
|