Create complex forms from a JSON schema with angular.
Generate forms from JSON schemas using AngularJS!
First, as there has been a rather intensive period of planning and change for this project, there have been important new developments for the project. Lets get into those first(the normal front page continues below):
A standard, json-schema-form, is being created.
After a phase of planning, the following list of projects has been decided upon: https://github.com/json-schema-form/json-schema-form/wiki/Current-projects
The next major release of ASF will be 1.0.
The goal for that version is to include the breaking changes that is needed for future developments, like *Of and local $refs:
There is now a UI for building schemas and forms being developed at json-schema-builder repository.
Ralphael Owino (main author), has a demo up already.
This is now a repository with template schemas and forms. So far all the schema.org types has been converted to JSON schema approximations, and also some has been further resolved and had (huge) forms generated. Schema.org is big.
The documentation is evolving, and it is happening mostly on the wiki:
These are just started.
If you use ASF in your project/company please let us know! We'd love to feature you on the site.
Try out the example page. Try editing the schema or form definition and see what comes out!
Hint: By pressing the 'Save to gist' button (top left), you can save your example into a shareable link.
Schema Form is a set of AngularJS directives (and a couple of services). It can do two things to make life easier:
Schema Form uses convention over configuration, so it comes packaged with some sensible defaults. But you can always customize it by changing the order and types of form fields.
Schema Form is inspired by the nice JSON Form library and aims to be roughly compatible with it, especially its form definition. So what sets Schema Form apart from JSON Form?
You can find all documentation here, it covers all the different field types and their options.
It also covers how to extend angular schema form with your own field types.
First, expose your schema, form, and model to the $scope.
Then load them into Schema Form using the
It's simplest to install Schema Form using Bower.
bower install angular-schema-form
This will install the latest release and basic dependencies. See dependecies section below.
You can also load the files via cdnjs.com.
You can also just download the contents of the
dist/ folder and add dependencies manually.
Schema form has a lot of dependencies, most of which are optional. Schema Form depends on:
If you install via bower you get all of the above except bootstrap since we don't want to push a certain version or flavor on you. Also make sure you got the angular version you actually want.
tabarray. Tab arrays default to tabs on the left side. For these to work, you'll need to include the CSS from bootstrap-vertical-tabs. However, you won't need Bootstrap Vertical Tabs for horizontal tabs (the
The minified files include templates - no need to load additional HTML files.
Schema form is split into two main files,
dist/boostrap-decorator.min.js and they need be loaded in that order. AngularJS,
tv4 and objectpath
also needs to be loaded before Schema Form.
Don't forget to load the
schemaForm module or nothing will happen.
Contributions are welcome! Please see Contributing.md for more info.
The files in the
dist/ folder, plus dependencies, are all you need to use Schema Form. But if
you'd like to build it yourself, we use gulp.
First off, you need to have nodejs installed. Then install all dev dependencies of the project with npm, install gulp and run the default task.
$ npm install$ sudo npm install -g gulp$ bower install$ gulp
The default task uses gulp-angular-templatecache to compile all html templates to js and then concatenates and minifies them with the rest of the sources.
You can also run
gulp watch to have it rebuild on change.
To run the tests:
$ npm install$ bower install$ sudo npm install -g karma-cli$ karma start karma.conf.js