node package manager

formlysix

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>