diff --git a/src/app/components/ngparam-input/ngparam-input.component.ts b/src/app/components/ngparam-input/ngparam-input.component.ts index adfaea812209eb87b33e2fc984af6de5634c3675..064101c27cdc6d60909ecd2e12122a6dfde39ef7 100644 --- a/src/app/components/ngparam-input/ngparam-input.component.ts +++ b/src/app/components/ngparam-input/ngparam-input.component.ts @@ -15,20 +15,27 @@ import { GenericInputComponent } from "../generic-input/generic-input.component" }) export class NgParamInputComponent extends GenericInputComponent { /** - * managed parameter + * paramètre géré */ @Input('param') private _paramDef: NgParameter; + /** + * valeur intermédiaire nécessitée par le fait que toutes les valeurs numériques ne sont pas légales + * pour NgParameter (l'affecter peut provoquer une exception) et qui permet de faire fonctionner la validation du modèle + */ + private _model: number; + constructor(private intlService: InternationalisationService) { super(); } protected getModelValue(): any { - return this._paramDef.getValue(); + return this._model; } protected setModelValue(v: any) { + this._model = v; try { this._paramDef.setValue(v); } @@ -75,4 +82,11 @@ export class NgParamInputComponent extends GenericInputComponent { protected uiToModel(ui: string) { return +ui; } + + protected afterFirstViewChecked() { + if (this._paramDef != undefined) + if (this._paramDef.isDefined) + this._model = this._paramDef.getValue(); + super.afterFirstViewChecked(); + } }