feat(forms): add ability to reset forms (#9974)

Closes #4914
Closes #4933
This commit is contained in:
Kara
2016-07-12 15:02:25 -07:00
committed by GitHub
parent 806a25413c
commit da8eb9f8b8
9 changed files with 705 additions and 23 deletions

View File

@ -105,7 +105,7 @@ export const formDirectiveProvider: any =
@Directive({
selector: '[formGroup]',
providers: [formDirectiveProvider],
host: {'(submit)': 'onSubmit()'},
host: {'(submit)': 'onSubmit()', '(reset)': 'onReset()'},
exportAs: 'ngForm'
})
export class FormGroupDirective extends ControlContainer implements Form,
@ -187,6 +187,8 @@ export class FormGroupDirective extends ControlContainer implements Form,
return false;
}
onReset(): void { this.form.reset(); }
/** @internal */
_updateDomValue() {
this.directives.forEach(dir => {