Skip to content

Commit

Permalink
feat: invalid output for feSubmit
Browse files Browse the repository at this point in the history
  • Loading branch information
navix committed Aug 27, 2022
1 parent 2ab66d0 commit 4bcbd81
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions projects/ngfe/src/lib/core/fe-submit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { FeForm } from './fe-form';
})
export class FeSubmit {
@Output() feSubmit = new EventEmitter();
@Output() invalid = new EventEmitter();

constructor(
@Optional() @Inject(FeForm) private form: FeForm,
Expand All @@ -23,6 +24,8 @@ export class FeSubmit {
this.form.touchAll();
if (this.form.valid) {
this.feSubmit.emit();
} else {
this.invalid.emit();
}
return false;
}
Expand All @@ -35,6 +38,7 @@ export class FeSubmit {
})
export class FeFormSubmit {
@Output() feSubmit = new EventEmitter();
@Output() invalid = new EventEmitter();

constructor(
@Inject(FeForm) private group: FeForm,
Expand All @@ -45,6 +49,8 @@ export class FeFormSubmit {
this.group.touchAll();
if (this.group.valid) {
this.feSubmit.emit();
} else {
this.invalid.emit();
}
}
}

0 comments on commit 4bcbd81

Please sign in to comment.