标签:
Check out on gitHub, see the example on Demo page, see the document, extension.
Mainly, there are three parts consist of Javascript part:
form, schema and model.
Schema :
I like define the schema first. Usually you will use two props:
type, properties & required.
{ "type": "object", "title": "Somehting ele", "properties": { "email": { "title": "Email", "type": "string", "pattern": "^\\S+@\\S+$", "description": "Email will be used for evil." } }, "required": [ "email" ] }
In ‘properties‘, is the place where you define the form elements. For example - "email".
Form:
Then in the form, if you thing the schema setting is ok, then in form:
[ "email" ]
Also you can overwrite the form: for example, I want to over the title, add a placeholder.
{ "key": "email", "type": "string", "title": "Email filed", "placeholder": "Email" }
"key" in the example matchs to the "email" in the shcema.
A good example for input field:
Schema:
"email": { "title": "Email", "type": "string", "pattern": "^\\S+@\\S+$", "maxlength": 120, "minlength": 3,
"validationMessage": "This is not an email" "description": "Email will be used for evil." }
Form:
{ "key": "email", "type": "string", "title": "Email filed", "placeholder": "Email" }
[AngularJS] angular-schema-form -- 1
标签:
原文地址:http://www.cnblogs.com/Answer1215/p/4240262.html