Open wardbell opened 8 years ago
See #7.
Not working for promises or observables
Neither of these implementations will stop a navigation
import { Injectable } from '@angular/core'; import { CanDeactivate } from '@angular/router'; import { CrisisDetailComponent } from './crisis-detail.component'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/observable/of'; import 'rxjs/add/observable/throw'; @Injectable() export class CanDeactivateCrisisDetail implements CanDeactivate<CrisisDetailComponent> { constructor(private dialog: DialogService) {} canDeactivate(component: CrisisDetailComponent): Observable<boolean> | boolean { return Observable.of(false); // doesn't work return Observable.throw(false); // neither does this. } }
See #7.
Not working for promises or observables
Neither of these implementations will stop a navigation