我已经安装了angular6-json-schema-form
。当我按照文档中的示例使用MaterialDesignFrameworkModule
时,效果很好:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { MaterialDesignFrameworkModule } from 'angular6-json-schema-form';
import { AppComponent } from './app.component';
@NgModule({
declarations: [ AppComponent ],
imports: [
MaterialDesignFrameworkModule
],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule { }
但是,当我使用NoFrameworkModule
(在文档中也有描述)时,json-schema-form
html元素停止工作。我收到此错误:
Uncaught Error: Template parse errors:
Can't bind to 'schema' since it isn't a known property of 'json-schema-form'.
1. If 'json-schema-form' is an Angular component and it has 'schema' input, then verify that it is part of this module.
2. If 'json-schema-form' 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. ("
<json-schema-form
loadExternalAssets="true"
[ERROR ->][schema]="exampleJsonObject"
framework="no-framework"
[(ngModel)]="exampleJsonObject">
"): ng:///CatalogModule/DatagridComponent.html@3:4
'json-schema-form' is not a known element:
1. If 'json-schema-form' is an Angular component, then verify that it is part of this module.
2. If 'json-schema-form' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("<p>
[ERROR ->]<json-schema-form
loadExternalAssets="true"
[schema]="exampleJsonObject"
或者,当我删除[schema]
属性时:
Uncaught Error: Template parse errors:
'json-schema-form' is not a known element:
1. If 'json-schema-form' is an Angular component, then verify that it is part of this module.
2. If 'json-schema-form' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("<p>
[ERROR ->]<json-schema-form
loadExternalAssets="true"
framework="no-framework">
"): ng:///CatalogModule/DatagridComponent.html@1:2
如何解决此问题?我在7.1.0版中使用该软件包。