0.1.7 • Published 8 years ago

wieldoformlymaterial v0.1.7

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

formlyMaterial

GitHub version Build Status GitHub issues GitHub license Gitter join

Wieldo formly Material to build forms with angular-formly and angular material design formly - http://angular-formly.com/
material design 1.0.6 - https://material.angularjs.org/1.0.6/demo/input


How to install

npm install wieldoformlymaterial

npm

https://www.npmjs.com/package/wieldoformlymaterial

Demo

github - https://github.com/wieldo/meteor-app
real example - http://meteor-app.wieldo.com/developers/forms

You can generate by json formly Types

  • Checkbox
  • Chips
  • Datepicker
  • Input
  • Radio
  • Select
  • Slider
  • Switch
  • Textarea

Custom

  • Select Day
  • Select Month
  • Select Year

Tests

Karma Jasmine - http://jasmine.github.io/2.0/introduction.html

  • Checkbox
  • Chips
  • Datepicker
  • Input
  • Radio
  • Select
  • Slider
  • Switch
  • Textarea

Custom

  • Select Day
  • Select Month
  • Select Year

templateOptions

default

templateOptionsdirectiveattributetypeapiCheck
ariaLabelaria-labelStringstring.optional
classNameclassStringstring.optional
disabledBooleanbool.optional
thememd-themeStringstring.optional
ngClassng-classFunctionfunc.optional
ngClickng-clickFunctionfunc.optional
ngDisabledng-disabledBooleanbool.optional
mdThememd-themeStringstring.optional

Click here to go for more information about templateOptions

Example

If you want to create simple signup form you can write javascript code below

fields = [
    {
        type: "input",
        key: "email",
        templateOptions: {
            type: "email",
            label: "Enter your email address",
            pattern: "/^.+@.+\..+$/",
            required: true
        },
        validation: {
            messages: {
                pattern: 'to.label + " pattern " + to.pattern + " is not correct"'
            }
        }
    },
    {
        type: "input",
        key: "password",
        templateOptions: {
            type: "password",
            label: "Enter your password",
            required: true
        }
    },
    {
        type: "input",
        key: "firstname",
        templateOptions: {
            label: "Enter your firstname",
            required: true
        }
    },
    {
        type: "input",
        key: "lastname",
        templateOptions: {
            type: "text",
            label: "Enter your lastname",
            required: true
        }
    }
]

with html in your view

<form name="form" ng-submit="onSubmit()">
    <formly-form model="model" fields="fields" options="options">
        <md-button type="submit" class="md-primary md-raised">
            signup
        </md-button>
    </formly-form>
</form>

Donate

If you want to help our developers create software donate please.

npm.io