Registry / development / angular6-json-schema-form

angular6-json-schema-form

JSON →
library8.0.0jsnpmunverified

Angular JSON Schema Form builder (v8.0.0) for generating dynamic forms from JSON Schema. Continuation of Angular2-json-schema-form. Supports Angular >=6, Material Design, Bootstrap 3/4, and no framework. Ships TypeScript types and offers a playground with 70+ examples. Peer dependencies include @angular/common, @angular/core, @angular/forms, @angular/flex-layout, rxjs, ajv, and lodash-es.

npm install angular6-json-schema-form
INSTALL
IMPORT
SIG · ANGULAR6-JSON-SCHE
A
angular6-json-schema-form
developmentjavascriptv8.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

JsonSchemaFormModule
import { JsonSchemaFormModule } from 'angular6-json-schema-form'
import { Angular6JsonSchemaFormModule } from 'angular6-json-schema-form'
The module is named JsonSchemaFormModule, despite the package name.
JsonSchemaFormService
import { JsonSchemaFormService } from 'angular6-json-schema-form'
import { JsonSchemaFormService } from 'angular6-json-schema-form/src/lib/json-schema-form.service'
Use the barrel export, not the deep import.
Framework
import { Framework } from 'angular6-json-schema-form'
import { Framework } from 'angular6-json-schema-form/src/lib/framework-library/framework'
Framework is re-exported from the main package.
WidgetLibraryService
import { WidgetLibraryService } from 'angular6-json-schema-form'
import { WidgetLibraryService } from 'angular6-json-schema-form/src/lib/widget-library/widget-library.service'
Use the barrel export.

Shows import and usage of JsonSchemaFormModule, the component tag, and a basic schema/layout.

import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { JsonSchemaFormModule } from 'angular6-json-schema-form'; import { AppComponent } from './app.component'; @NgModule({ declarations: [AppComponent], imports: [ BrowserModule, JsonSchemaFormModule.forRoot() ], bootstrap: [AppComponent] }) export class AppModule { } // In your component: import { Component } from '@angular/core'; @Component({ selector: 'app-root', template: `<json-schema-form [schema]="schema" [layout]="layout"></json-schema-form>` }) export class AppComponent { schema = { "type": "object", "title": "Example Schema", "properties": { "name": { "type": "string", "title": "Name" }, "age": { "type": "integer", "title": "Age" } }, "required": ["name"] }; layout = [{ "key": "name" }, { "key": "age" }]; }
Debug
Known issues
deprecatedPackage name is angular6-json-schema-form but supports Angular 6+; do not install angular2-json-schema-form for Angular 6+.
fix
Use angular6-json-schema-form, not angular2-json-schema-form.
affects: >=8.0.0
gotchaMaterial Design and Bootstrap 4 require additional setup (e.g., importing respective CSS).
fix
Import Material theme (e.g., @angular/material/prebuilt-themes/indigo-pink.css) or Bootstrap CSS.
affects: >=8.0.0
gotchaThe layout array uses bracket notation for keys, not dot notation.
fix
Use [{ 'key': 'propertyName' }] not [{ 'key': 'property.name' }].
affects: >=8.0.0
breakingAngular 16 dropped support for Angular 6/7; if using Angular >=16, this library may not work properly.
fix
Downgrade Angular or use a different form builder.
affects: >=8.0.0
deprecatedThe library uses ajv v6; newer ajv v8 has breaking changes in API.
fix
If you override the ajv instance, ensure compatibility with v6.
affects: >=8.0.0
Errors
Common errors & fixes
ERROR in node_modules/angular6-json-schema-form/lib/json-schema-form.module.d.ts:1:22 - error NG6002: Appears in the NgModule.imports of AppModule, but itself has errors.
Missing Angular peer dependencies or incompatible versions.
fix
Ensure @angular/core, @angular/common, @angular/forms, @angular/flex-layout are installed and compatible.
NullInjectorError: No provider for JsonSchemaFormService!
JsonSchemaFormModule.forRoot() not called in root module.
fix
Import JsonSchemaFormModule.forRoot() in AppModule.
TypeError: Cannot read property 'schema' of undefined
The component's schema input is undefined.
fix
Initialize the schema property in the component: schema = {}; or provide a valid JSON Schema object.
Can't bind to 'layout' since it isn't a known property of 'json-schema-form'.
JsonSchemaFormModule not imported or not in the imports array of the current module.
fix
Import JsonSchemaFormModule in the module that declares the component.
Upgrade
Version history
8.0.0latest on npm
Audit
Dependencies
@angular/commonrequiredCore Angular module
@angular/corerequiredCore Angular module
@angular/formsrequiredReactive forms support
@angular/platform-browserrequiredBrowser platform utilities
@angular/flex-layoutrequiredFlex layout for responsive forms
rxjsrequiredObservables and reactive streams
ajvrequiredJSON Schema validation
lodash-esrequiredUtility functions
Agent activity
51 hits · last 30 days
node
43
Perplexity
1
OpenAI (training)
1
Resources
angular6-json-schema-form — npm install angular6-json-schema-form · libregistry