AngularJS Formly – Render JSON based forms
AngularJS Formly is a nice project I found recently in Github which shows clearly the power of AngularJs framework. Formly is a directive that takes Json data that represent a form and it renders them in Html. This is very useful for creating dynamic forms based on users interactions, eg on-line surveys. It can be used like this:
<formly-form result="formData" fields="formFields" options="formOptions" ng-submit="onSubmit()"> </formly-form>
Installation is simple:
- Install with Bower
$ bower install angular-formly
- Include the files in your index.html
<script src="bower_components/angular-formly/dist/formly.min.js"></script>
- Add ‘formly’ as a required module to your angular app, usually in
app.js
:
var app = angular.module('app', ['ng', 'ui.router', 'formly']);
A demo can be found here