angular2-json-schema-form icon indicating copy to clipboard operation
angular2-json-schema-form copied to clipboard

How to reset form values ?

Open catull opened this issue 7 years ago • 0 comments

Issue type

I'm submitting a (check one): [X] Documentation issue or request

Prerequisites

Before posting, make sure you do the following (check all): [x] Confirm you are using the latest versions of all necessary packages (or if not, explain why not) [x] Search GitHub for a similar issue or PR [x] If submitting a Support request, also search [Stack Overflow][stack-overflow] for similar issues

Current behaviour

Using this on reset button click:

  reset () {
    this.criteria = {};
    this.schemaService.resetAllValues();
  }  

criteria is a simple object, which is displayed in the JSON schema form.

The schemaService is imported with

import { JsonSchemaFormService } from 'angular2-json-schema-form';

it is injected in the constructor

Neither the explicit setting of criteria nor the calling of schemaService.resetAllValues() reset the form values.

The HTML template is this:

        <json-schema-form [framework]="'bootstrap-3'" [schema]='jsonSchema' [(ngModel)]='criteria' [form]='jsonForm' [options]='jsonFormOptions' [debug]='false' (onChanges)='onChanges ($event)' (onSubmit)='onSubmit ($event)' (isValid)='onIsValid ($event)' (validationErrors)='onValidationErrors ($event)'>
        </json-schema-form>

Expected behaviour

What must be done to reset FORM values ?

Environment

OS name & version: macOS 10.12.6 (Sierra) Browser name & version: any browser Angular version: 1.7.3 Angular JSON Schema Form version(s): 0.7.0-alpha.1

catull avatar Mar 28 '18 15:03 catull