json-schema-form / angular-schema-form

Generate forms from a JSON schema, with AngularJS!
https://json-schema-form.github.io/angular-schema-form
MIT License
2.47k stars 653 forks source link

How to link a custom button and method? #956

Closed person2713 closed 6 years ago

person2713 commented 6 years ago

I add custom button to form use next:

public layout = [
      '*',
      { type: 'submit', title: 'Apply' },
      {
        type: 'button',
        title: 'Save',
        // onClick: this.exampleLog(event)
        // onChanges: this.exampleLog(event)
        onClick: 'exampleLog()'
      }
    ];

public exampleLog() {
  Log.create('Save').d('message');
}

Then I try to link button 'Save' and function "exampleLog()' but, i don't know how do it. I use angular 2 on typescript and json-schema for angular. Can you give me some example how do it?