Skip to content

Commit

Permalink
better handling with form field name with dot (#1446)
Browse files Browse the repository at this point in the history
  • Loading branch information
syjer authored Jan 20, 2025
1 parent b4a52f4 commit dfa2858
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class AdditionalFieldComponent implements OnInit, OnDestroy {
this.yesterday = new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
.toISOString()
.substring(0, 10);
this.subscriptions.push(this.form.get(this.field.name).valueChanges
this.subscriptions.push(this.form.get([this.field.name]).valueChanges
.subscribe(() => this.selectedDateDescription = this.localizedSelectedDate()));
}
this.dateFormat = new Intl.DateTimeFormat(this.translate.currentLang, {
Expand Down Expand Up @@ -100,7 +100,7 @@ export class AdditionalFieldComponent implements OnInit, OnDestroy {
}

selectedCheckBox(index: number, value: string, checked: boolean) {
const fa = this.form.get(this.field.name) as UntypedFormArray;
const fa = this.form.get([this.field.name]) as UntypedFormArray;
fa.controls[index].setValue(checked ? value : null, {emitEvent: false, emitViewToModelChange: false});
}

Expand All @@ -114,7 +114,7 @@ export class AdditionalFieldComponent implements OnInit, OnDestroy {

private localizedSelectedDate(): string {
try {
const value = (this.form.get(this.field.name) as UntypedFormArray).at(0)?.value;
const value = (this.form.get([this.field.name]) as UntypedFormArray).at(0)?.value;
if (value != null && value.trim() !== '') {
return this.dateFormat.format(Date.parse(value));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class InvalidFeedbackDirective implements OnInit, OnDestroy {
ngOnInit(): void {

if (this.control == null && this.invalidFeedbackForm != null && this.invalidFeedbackFieldName != null) {
this.targetControl = this.invalidFeedbackForm.get(this.invalidFeedbackFieldName);
this.targetControl = this.invalidFeedbackForm.get([this.invalidFeedbackFieldName]);
this.targetControl.statusChanges.subscribe(e => {
this.checkValidation();
});
Expand Down

0 comments on commit dfa2858

Please sign in to comment.