Registry / devops / angular-schema-form

angular-schema-form

JSON →
library0.8.13jsnpmunverified

Generate forms from JSON schemas using AngularJS. Stable version 0.8.13 (last release in 2017). This library provides AngularJS directives to create forms directly from a JSON schema, with validation against JSON Schema v4 via tv4. It produces Bootstrap 3-friendly HTML by default. The project is in maintenance mode; development has shifted to newer versions. Differentiators include deep AngularJS integration, use of tv4 for validation, and convention-over-configuration defaults.

npm install angular-schema-form
INSTALL
IMPORT
SIG · ANGULAR-SCHEMA-FOR
A
angular-schema-form
devopsjavascriptv0.8.13
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.

schemaForm
angular.module('myApp', ['schemaForm'])
import schemaForm from 'angular-schema-form'
ES module import not supported; use AngularJS module injection.
sfSelect
angular.module('myApp').controller('Ctrl', function(sfSelect) { ... })
import { sfSelect } from 'angular-schema-form'
Service, must be injected via AngularJS DI.
schemaFormDecoratorsProvider
angular.module('myApp').config(function(schemaFormDecoratorsProvider) { ... })
const schemaFormDecoratorsProvider = require('angular-schema-form');
Provider, used in config phase for customization.

Shows basic setup with schema, form, model and binding to HTML template.

// Ensure AngularJS 1.3+ and tv4 are loaded. angular.module('myApp', ['schemaForm']) .controller('FormController', function($scope) { $scope.schema = { type: 'object', properties: { name: { type: 'string', minLength: 2, title: 'Name', description: 'Name or alias' }, email: { type: 'string', format: 'email', title: 'Email' } }, required: ['name', 'email'] }; $scope.form = ['*', { type: 'submit', title: 'Save' }]; $scope.model = {}; }); // In HTML: // <div ng-app="myApp" ng-controller="FormController"> // <form sf-schema="schema" sf-form="form" sf-model="model"></form> // </div>
Debug
Known issues
gotchaAngular Schema Form uses tv4 for validation, which supports JSON Schema v4 only. Properties like const or if/then/else from newer drafts are ignored.
fix
Use JSON Schema v4 compatible schemas; avoid v6/v7 keywords.
affects: >=0.8.0
deprecatedThis package has been superseded by @guillotinaweb/json-schema-form and angular-schema-form-bootstrap.
fix
Consider migrating to actively maintained forks.
affects: >=0.8.0
breakingIn version 0.8.0, the module name changed from 'schemaForm' to 'schemaForm' (same) but the form directive required 'sf-form' attribute instead of 'form'. Old 'form' attribute is no longer supported.
fix
Use sf-form='form' instead of form='form'.
affects: >=0.8.0
gotchaAngular Schema Form does not work with Angular (v2+) or modern frameworks; it requires AngularJS (1.x).
fix
Use AngularJS 1.3+ and include the correct AngularJS version.
affects: >=0.8.0
gotchaThe model object must be initialized before the form is rendered, otherwise the form may lose values on submit.
fix
Initialize $scope.model = {} in controller.
affects: >=0.8.0
Errors
Common errors & fixes
Error: [$injector:modulerr] Failed to instantiate module myApp due to: Error: [$injector:modulerr] Failed to instantiate module schemaForm due to: Error: [$injector:nomod] Module 'schemaForm' is not available!
Missing script include for angular-schema-form.js or tv4.js.
fix
Ensure both tv4.js and angular-schema-form.js are loaded before your app module.
TypeError: Cannot read property 'schema' of undefined
sf-schema directive not bound to a scope property.
fix
Check that $scope.schema is defined and the attribute is sf-schema not schema.
Unknown provider: sfSelectProvider <- sfSelect
schemaForm module not included as dependency.
fix
Include 'schemaForm' in your app module: angular.module('myApp', ['schemaForm']).
Upgrade
Version history
0.8.13latest on npm
Audit
Dependencies
angularrequiredPeer dependency; requires AngularJS >=1.3.x
tv4requiredJSON Schema v4 validation library
Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
angular-schema-form — npm install angular-schema-form · libregistry