我正在使用
https://github.com/dschnelldavis/angular2-json-schema-form,我的表单HTML是:
<json-schema-form [schema]="schema" (onSubmit)="exampleOnSubmitFn($event)"> </json-schema-form>
我的架构是:
this.schema = { type: "object",properties: { CCN: { required: true,type: "number",minimum: 1000000000,maximum: 99999999999999999999 },Quarter: { type: 'string',required: true,enum: ['Q1','Q2','Q3','Q4'] },Year: { type: 'string',enum: ['2018','2019','2020'] },covered_medi: { title: "Covered by Medicare/Medicaid",required: true },covered_private: { title: "Covered by private insurance",Uninsured: { type: "number",} }
我希望Quarter和Year在一个单独的部分.我尝试使用layout属性:
this.layout = [{ type: "fieldset",title: "Reporting Period",items: [{ key: "Quarter" },{ key: "Year" }] }]
但这似乎行不通.
如果您有
installed and instantiated the provider.唯一可能失败的是schema,examples或回调,使用空的测试.
原文链接:https://www.f2er.com/angularjs/141183.htmlTS
@Component({...}) export class MyComponent { public schema: any = {...} public onSubmit(event) {...} ... }
HTML
<json-schema-form [schema]="schema" (onSubmit)="onSubmit($event)"> </json-schema-form>