Skip to content
Snippets Groups Projects
Commit 8b4d781e authored by francois.grand's avatar francois.grand
Browse files

#45 mise en place du mécanisme de sérialisation JSON des formulaires

parent e7ac088e
No related branches found
No related tags found
1 merge request!20Resolve "Ouvrir / Enregistrer une session / une calculette"
......@@ -221,8 +221,11 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
private doSaveForm(calcList: any[]) {
console.log("---");
for (const c of calcList)
if (c.selected)
if (c.selected) {
console.log(c.title);
const form: FormulaireDefinition = this.formulaireService.getFormulaireFromId(c.uid);
console.log(JSON.stringify(form.JSONserialise()));
}
}
private closeCalculator(form: FormulaireDefinition) {
......
......@@ -143,4 +143,18 @@ export abstract class FormulaireNode implements IObservable {
notifyObservers(data: any, sender?: any) {
this._observable.notifyObservers(data, sender);
}
protected toJSON(): any {
return {};
}
/**
* sérialisation en JSON
*/
public JSONserialise(): any {
let res = this.toJSON();
for (const k of this._kids)
res[k.id] = k.JSONserialise();
return res;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment