Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Commit

Permalink
MODUL-1153 - Remplacer les opérations d'ajout et de suppression (#1094)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucmartin3elien authored and chuckmah committed Jul 31, 2019
1 parent 12f4255 commit 9618026
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/utils/form/form-group.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Vue from 'vue';
import { AbstractControl } from './abstract-control';
import { ControlError } from './control-error';
import { ControlOptions } from './control-options';
Expand Down Expand Up @@ -135,24 +136,17 @@ export class FormGroup<T = any> extends AbstractControl {
throw Error(`There is already a control with name ${name} in this group`);
}

const result: any = Object.assign(this._controls);

control.parent = this;
result[name] = control;

this._controls = result;
Vue.prototype.$set(this._controls, name, control);
}

public removeControl(name: string): void {
if (this._controls[name] === undefined) {
throw Error(`There is no control with name ${name} in this group`);
}

const result: any = Object.assign(this._controls);

delete result[name];

this._controls = result;
Vue.prototype.$delete(this._controls, name);
}

private setupControlsParent(): void {
Expand Down

0 comments on commit 9618026

Please sign in to comment.