manishit56 / Angular4-JsonEditor

Wrapper for jsonedior in angular 4+ application
MIT License
39 stars 17 forks source link

Get error in my template when using this package #1

Closed EmmanuelAmodu closed 5 years ago

EmmanuelAmodu commented 7 years ago

First thanks for taking the time to wrote this package, I am currently having issues with it as it returns it gives me a parse error on my view.

compiler.es5.js:1690 Uncaught Error: Template parse errors: Can't bind to 'options' since it isn't a known property of 'json-editor'.

  1. If 'json-editor' is an Angular component and it has 'options' input, then verify that it is part of this module.
  2. If 'json-editor' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
  3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
<div>
  <json-editor [ERROR ->][options]="editorOptions" [data]="menuItem"></json-editor >
</div>

"): ng:///UssdManagerModule/CreateComponent.html@90:15

EmmanuelAmodu commented 7 years ago

So I fixed this I think by adding schemas: [ CUSTOM_ELEMENTS_SCHEMA ] in my AppModule, now I get this error

ERROR in C:/Users/Tivas/Desktop/ussdFrontEnd/node_modules/angular4-jsoneditor/jsoneditor/jsoneditor.component.ts (20,19): Cannot use 'new' with an expression whose type lacks a call or construct signature.

in my console

manishit56 commented 7 years ago

Hi, Seeing your first comments, looks like below code is missing in your xx.component.ts file import { JsonEditorComponent, JsonEditorOptions } from './ng4-jsoneditor';

export class xxComponent { public editorOptions: JsonEditorOptions;

@ViewChild(JsonEditorComponent) editor: JsonEditorComponent;

constructor() { this.editorOptions = new JsonEditorOptions() }

}

Please share your code so I can take a look in details. I have added demo project as well with git code