Angular Formus

Form generator for AngularJS


Project maintained by NullRefExcep Hosted on GitHub Pages — Theme by mattgraham

Customizable and extensible forms generator for AngularJS. License under MIT License.

Model

{{form.data | json}}

Errors

{{form.errors | json}}

Simple form

Install

$ bower install -S angular-formus

Include in index.html

<script src="/bower_components/angular-formus/dist/formus.min.js"></script>

Application configuration

var app = angular.module('app', ['formus',]);

Object with configs

var formsConfiguration = {
    firstForm: {/* Config */}
};
app.constant('F_CONFIG', formsConfiguration);
app.config(['FormusContainerProvider','F_CONFIG', 
    function(FCP, FC) {FCP.setContainer(FC);}
]);

Controller

app.controller('MainCtrl', function($scope, FormusContainer, FormusHelper, FORMS_CONFIG, $http) {
    var form = $scope.form = FormusContainer.get('firstForm');
    $scope.src = FORMS_CONFIG.firstForm;
    form.config.buttons[0].handler = function() {
        $http.get('https://api.github.com/users').success(function(data) {
            form.fieldset.fields[4].items = FormusHelper.extractItems(data, 'id', 'login');
        });
    };
});
                    

JSON configuration

{{src | json}}