Registry / testing / angular2-json-schema-form

angular2-json-schema-form

JSON →
library0.7.0-alpha.1jsnpmunverified

Angular JSON Schema Form is a dynamic form builder for Angular (4+) that generates forms from JSON Schema. The current stable version is 0.7.0-alpha.1 (pre-release). It supports multiple UI frameworks (Material Design, Bootstrap 3/4) and is compatible with Angular 4 and 5. Key differentiators: it is inspired by Angular Schema Form, React JSON Schema Form, and JSON Form, but built natively for Angular with TypeScript support. The library ships with type definitions and has peer dependencies on Angular components and Angular CDK/Material. It is still in alpha, so expect breaking changes.

npm install angular2-json-schema-form
INSTALL
IMPORT
SIG · ANGULAR2-JSON-SCHE
A
angular2-json-schema-form
testingjavascriptv0.7.0-alpha.1
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 'angular2-json-schema-form';
import { JsonSchemaFormModule } from '@angular2-json-schema-form';
Module for JSON Schema Form functionality, must be imported in your Angular module.
FrameworkModule
import { FrameworkModule } from 'angular2-json-schema-form';
import { MaterialDesignFrameworkModule } from 'angular2-json-schema-form';
Framework module for styling; you must import a specific framework (e.g., MaterialDesignFrameworkModule) separately.
MaterialDesignFrameworkModule
import { MaterialDesignFrameworkModule } from 'angular2-json-schema-form';
import { MaterialDesignFrameworkModule } from 'angular2-json-schema-form/material';
Provides Material Design styling for the form.
JsonSchemaFormComponent
import { JsonSchemaFormComponent } from 'angular2-json-schema-form';
import { JsonSchemaFormComponent } from 'angular2-json-schema-form/bundle';
Component class for the form; can be used in templates.

Shows how to import modules, configure Angular module, and use JsonSchemaFormComponent in a template with a form JSON object.

import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { JsonSchemaFormModule, MaterialDesignFrameworkModule } from 'angular2-json-schema-form'; import { AppComponent } from './app.component'; @NgModule({ declarations: [AppComponent], imports: [ BrowserModule, JsonSchemaFormModule, MaterialDesignFrameworkModule ], bootstrap: [AppComponent] }) export class AppModule { } // In app.component.ts: import { Component } from '@angular/core'; @Component({ selector: 'app-root', template: ` <json-schema-form [form]="myForm" [loadExternalAssets]="true" (onChanges)="onChanges($event)"> </json-schema-form> ` }) export class AppComponent { myForm = { "schema": { "type": "object", "title": "Example", "properties": { "name": { "type": "string" }, "age": { "type": "integer" } } }, "layout": [] }; onChanges(data: any) { console.log('Form data changed:', data); } }
Debug
Known issues
breakingIn version 0.7.0-alpha.1, you must now import both JsonSchemaFormModule and a framework module (e.g., MaterialDesignFrameworkModule).
fix
Add both imports to your NgModule.
affects: >=0.7.0-alpha.1
deprecatedAngular 4 and 5 are deprecated; the library may not work with Angular 6+.
fix
Consider migrating to a newer form library or check compatibility.
affects: <0.7.0-alpha.1
gotchaThe loadExternalAssets input must be set to true for Material Design framework to load CSS/JS.
fix
Set [loadExternalAssets]="true" on the component.
affects: *
deprecatedThe library is in alpha; API may change without notice. Not recommended for production.
fix
Pin to a specific version and test thoroughly.
affects: 0.x
Errors
Common errors & fixes
ERROR in node_modules/angular2-json-schema-form/lib/src/shared/utility.class.d.ts:1:1 - error TS1436: Decorators are not valid here.
Angular version mismatch (probably Angular 6+).
fix
Use an older version of the library or upgrade to a compatible Angular version.
Module not found: Error: Cannot resolve module '@angular/material'
@angular/material peer dependency missing.
fix
Install @angular/material: npm install @angular/material @angular/cdk
Can't bind to 'form' since it isn't a known property of 'json-schema-form'
JsonSchemaFormModule not imported in the module.
fix
Import JsonSchemaFormModule in your NgModule.
No provider for JsonSchemaFormService!
Missing JsonSchemaFormModule or framework module import.
fix
Import both JsonSchemaFormModule and a framework module (e.g., MaterialDesignFrameworkModule).
Upgrade
Version history
0.7.0-alpha.1latest on npm
Audit
Dependencies
@angular/cdkrequiredRequired for Angular Material components
@angular/commonrequiredAngular core module
@angular/corerequiredAngular core module
@angular/flex-layoutrequiredFor responsive layout
@angular/formsrequiredRequired for reactive forms
@angular/materialrequiredMaterial Design components
@angular/platform-browserrequiredAngular platform module
rxjsrequiredReactive extensions library
Agent activity
35 hits · last 30 days
node
28
OpenAI (training)
1
Resources
angular2-json-schema-form — npm install angular2-json-schema-form · libregistry