formlysix
v1.0.4
Published
library for esier way of creation form with angular using formly-form in ECMAScript 6/7
Downloads
1
Readme
formlysix
Module to help build formly-from using ECMAScript7 in angularjs modules.
Examples
form.js
import {InputField, FieldGroup} from 'formlysix/baseFields';
class MyForm {
myInput = new InputField('Title', 'modelTitle', {className: 'col-sm-6'});
mySelect new SelectField('Options', 'selected', {
options: [{value: 1, name: 'Some option'}],
className: 'col-sm-6'
});
layout = [new FieldGroup([myInput, mySelect])]
}
export {MyForm}
controller.js
import {MyForm} from './form.js';
class MyController {
constructor() {
var form = new MyForm();
this.formFields = form.layout;
};
someModel = {}
}
angular.module('example', ['formlysix'])
.controller('FormCtrl', MyController)
view.html
<script src="formlysix.min.js"></script>
<script src="yourApp.js"><script>
....
<form data-ng-controller='MyController as vm'>
<formly-form model='vm.someModel' fields='vm.formFields'></formly-form>
</form>