我已经安装了angular6-json-schema-form
。当我MaterialDesignFrameworkModule
在文档中的示例中使用 as 时,它可以正常工作:
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 中的包。