Skip to content

Commit

Permalink
fix: fix resetting form to default values (#2816)
Browse files Browse the repository at this point in the history
  • Loading branch information
waterplea authored Jan 22, 2025
1 parent 4797973 commit baa4c1f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
3 changes: 0 additions & 3 deletions web/projects/ui/src/app/components/form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,7 @@ export class FormComponent<T extends Record<string, any>> implements OnInit {
}

onReset() {
const { value } = this.form

this.form = this.formService.createForm(this.spec)
this.process(compare(this.form.value, value))
tuiMarkControlAsTouchedAndValidate(this.form)
this.markAsDirty()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
></tui-tooltip>
<tui-toggle
size="l"
[style.margin-inline-start]="'auto'"
[disabled]="!!spec.disabled || readOnly"
[(ngModel)]="value"
(focusedChange)="onFocus($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Control } from '../control'
@Component({
selector: 'form-toggle',
templateUrl: './form-toggle.component.html',
host: { class: 'g-toggle' },
host: { style: 'display: flex' },
})
export class FormToggleComponent extends Control<
IST.ValueSpecToggle,
Expand Down

0 comments on commit baa4c1f

Please sign in to comment.