Skip to content

Commit 4bcbd81

Browse files
committed
feat: invalid output for feSubmit
1 parent 2ab66d0 commit 4bcbd81

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

projects/ngfe/src/lib/core/fe-submit.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { FeForm } from './fe-form';
99
})
1010
export class FeSubmit {
1111
@Output() feSubmit = new EventEmitter();
12+
@Output() invalid = new EventEmitter();
1213

1314
constructor(
1415
@Optional() @Inject(FeForm) private form: FeForm,
@@ -23,6 +24,8 @@ export class FeSubmit {
2324
this.form.touchAll();
2425
if (this.form.valid) {
2526
this.feSubmit.emit();
27+
} else {
28+
this.invalid.emit();
2629
}
2730
return false;
2831
}
@@ -35,6 +38,7 @@ export class FeSubmit {
3538
})
3639
export class FeFormSubmit {
3740
@Output() feSubmit = new EventEmitter();
41+
@Output() invalid = new EventEmitter();
3842

3943
constructor(
4044
@Inject(FeForm) private group: FeForm,
@@ -45,6 +49,8 @@ export class FeFormSubmit {
4549
this.group.touchAll();
4650
if (this.group.valid) {
4751
this.feSubmit.emit();
52+
} else {
53+
this.invalid.emit();
4854
}
4955
}
5056
}

0 commit comments

Comments
 (0)