Created
December 13, 2017 17:44
-
-
Save brachi-wernick/846297a2ab39f48c4cc2927507cf07b9 to your computer and use it in GitHub Desktop.
FormCanDeactivate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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