Material Design Templates for Angular-Formly. Modern & flexible forms configured easily in a JSON object.
npm install angular-formly-material
bower install angular-formly-material
meteor add wieldo:angular-formly-templates-material
- Add package using one of methods above
- Add the following dependencies to your AngularJS module:
angular.module('myAppName', [
'formlyMaterial'
])
- angular ~ 1.4.0
- angular-messages ~ 1.4.0
- angular-material ~ 0.11.0
- angular-formly ~ 7.3.0
Any requests? Add issue!
md-theme attribute
{
"type": "input",
"key": "firstName",
"templateOptions": {
"type": "text",
"label": "First name",
"theme": "custom"
}
}
rows (number, optional)
{
"type": "textarea",
"key": "bio",
"templateOptions": {
"label": "Biography",
"theme": "custom",
"rows": 5
}
}
options (array, requred)
labelProp (string, optional)
valueProp (string, optional)
{
"type": "radio",
"key": "name",
"templateOptions": {
"label": "Name",
"theme": "custom",
"labelProp": "firstName",
"valueProp": "id",
"options": [
{"firstName": "Sarah", id: 1},
{"firstName": "Jessica", id: 2},
{"firstName": "Parker", id: 3}
]
}
}
options (array, requred)
labelProp (string, optional)
valueProp (string, optional)
multiple (boolean, optional)
{
"type": "select",
"key": "name",
"templateOptions": {
"label": "Name",
"theme": "custom",
"multiple": true,
"labelProp": "firstName",
"valueProp": "id",
"options": [
{"firstName": "Sarah", id: 1},
{"firstName": "Jessica", id: 2},
{"firstName": "Parker", id: 3}
]
}
}
{
"type": "checkbox",
"key": "terms",
"templateOptions": {
"label": "Terms and Conditions",
"theme": "custom"
}
}
{
"type": "switch",
"key": "terms",
"templateOptions": {
"label": "Terms and Conditions",
"theme": "custom"
}
}
placeholder (string, optional)
md-placeholder
minDate (Date, optional)
md-min-date
maxDate (Date, optional)
md-max-date
filterDate (function, optional)
md-filter-date
{
"type": "datepicker",
"key": "start",
"templateOptions": {
"theme": "custom",
"placeholder": "Start date",
"minDate": minDate, // instance of Date
"maxDate": maxDate, // instance of Date
"filterDate": function(date) {
// only weekends
var day = date.getDay();
return day === 0 || day === 6;
}
}
}
placeholder (string, optional)
placeholder attribute value
secondaryPlaceholder (string, optional)
secondary-placeholder attribute value
deleteButtonLabel (string, optional)
delete-button-label attribute value
deleteHint (string, optional)
delete-hint attribute value
{
"type": "chips",
"key": "tags",
"templateOptions": {
"theme": "custom",
"placeholder": "+tags",
"secondaryPlaceholder": "Add tag",
"deleteButtonLabel": "Remove",
"deleteHint": "Remove tag"
}
}
min (number, optional)
default 1
max (number, optional)
default 100
step (number, optional)
default 1
discrete (boolean, optional)
default false (md-discrete)
{
"type": "slider",
"key": "rate",
"templateOptions": {
"theme": "custom",
"min": 1,
"max": 5,
"step": 0.5,
"discrete": true
}
}
- inputContainer (md-input-container)
- label
- messages (ng-messages)
- add md-chips
- add md-datepicker
- add md-icon wrapper
- add md-slider with min, max, step and discrete options
- add md-select
- multiple in md-select
- add groups to md-select
- add valueProp, labelProp to md-select
- add md-radio with valueProp and labelProp
- add textarea with cols and rows
- md-theme
- e2e tests
Requests (?). Post an issue.