Skip to content

Instantly share code, notes, and snippets.

@brachi-wernick
Created December 13, 2017 17:44
Show Gist options
  • Save brachi-wernick/846297a2ab39f48c4cc2927507cf07b9 to your computer and use it in GitHub Desktop.
Save brachi-wernick/846297a2ab39f48c4cc2927507cf07b9 to your computer and use it in GitHub Desktop.
FormCanDeactivate
import {ComponentCanDeactivate} from '../can-deactivate/component-can-deactivate';
import {NgForm} from "@angular/forms";
export abstract class FormCanDeactivate extends ComponentCanDeactivate{
abstract get form():NgForm;
canDeactivate():boolean{
return this.form.submitted || !this.form.dirty
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment