1.3.4 • Published 29 days ago

ng-svelte-jsoneditor v1.3.4

Weekly downloads
-
License
MIT
Repository
github
Last release
29 days ago

ng-svelte-jsoneditor

Angular Json Editor (wrapper for svelte-jsoneditor). View/Edit Json file with formatting.

A web-based tool to view, edit, format, transform, and validate JSON.

Installation

  npm install ng-svelte-jsoneditor

Usage

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    ......
    NgSvelteJsonEditorModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
<ng-svelte-jsoneditor [formControl]="editor"></ng-svelte-jsoneditor>

Methods

<ng-svelte-jsoneditor [formControl]="editor" [options]="options" (onInitialized)="onInitialized($event)"></ng-svelte-jsoneditor>

Use pre-defined options & methods

options: JSONEditorPropsOptional = {
  onChange: (c) => {
    //console.log(c);   
  }
};

Same methods are accessible via subscription

onInitialized(eventSub: {[key: string]: Subject<any>}) {
  eventSub['onChange'].subscribe((c: any) => {
    
  });
}

Supported Methods For Above

onChangeQueryLanguage
onChange
onClassName
onChangeMode
onSelect
onError
onFocus
onBlur

@Inputs - methods

onRenderValue
onRenderMenu
onRenderContextMenu

Accessing component reference

@ViewChild(NgSvelteJsoneditorComponent, { static: true }) ngSvelteJsoneditorComponent: NgSvelteJsoneditorComponent | undefined

Disable field

this.editor.disable()

Set options

<!-- Method 1 -->
this.ngSvelteJsoneditorComponent?.setOptions(
  {
    mode: Mode.text
  }
)

<!-- Method 2 -->
this.options.mode = Mode.text;
this.options = JSON.parse(JSON.stringify(this.options))

Documentation

Documentation

License

ng-svelte-jsoneditor is released as open source under the permissive the ISC license. MIT

1.3.4

29 days ago

1.3.2

29 days ago

1.3.1

29 days ago

1.3.0

29 days ago

1.2.0

30 days ago

1.1.0

30 days ago

1.0.0

30 days ago

0.4.0

30 days ago

0.3.0

30 days ago

0.2.0

30 days ago

0.1.0

30 days ago

0.0.1

30 days ago