Skip to content
This repository was archived by the owner on Jan 5, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { ErrorMessage } from "../../Models/error-message";
`
})
export class FormGroupComponent implements OnInit, AfterContentInit {
@ContentChildren(FormControlName, {descendants: true})
@ContentChildren(FormControlName, { descendants: true })
FormControlNames: QueryList<FormControlName>;

@Input()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* @Author: Zhenxiang Chen
* @Date: 2021-05-22 18:15:39
* @Last Modified by: Zhenxiang Chen
* @Last Modified time: 2021-05-22 18:15:39
*/
import {
Directive,
Input,
Expand Down Expand Up @@ -25,13 +31,20 @@ export class FormControlDirective {
formControlName: string;
@Input()
formControl: string;
@Input()
showValid = true;
@Input()
showValidWhenEmpty = false;

@HostBinding("class.is-valid")
get validClass() {
if (!this.control) {
if (!this.control || !this.showValid) {
return false;
}
return (
(this.showValidWhenEmpty
? true
: this.control.value != null && this.control.value != "") &&
this.bootstrapFour &&
this.control.valid &&
(this.control.touched || this.control.dirty)
Expand Down