0.1.14 • Published 7 years ago
tap-json-editor v0.1.14
angular-json-editor
Simple angular 4 wrapper for json-editor
Usage
Install with npm
npm install --save tap-json-editor
Import the editor module
import { JsonEditorModule } from 'tap-json-editor';
Include it in your root module
@NgModule({
imports: [
...
JsonEditorModule,
...
]
})
export default class AppModule {}
Add the component to the template
<div>
<json-editor [options]="editorOptions" [data]="data"></json-editor >
</div>
Create a component to set options and call methods on the jsoneditor
import { Component, ViewChild } from '@angular/core';
import { JsonEditorComponent, JsonEditorOptions } from 'tap-json-editor';
@Component({
...
})
export class DetailComponent {
public editorOptions: JsonEditorOptions;
public data: any = {
...
}
@ViewChild(JsonEditorComponent) editor: JsonEditorComponent;
constructor(...) {
this.editorOptions = new JsonEditorOptions();
}
}