你能告诉我如何显示所需的和无效的?换句话说不同的消息。使用的插件。在有一些必需的参数。而一些我需要验证例如“电子邮件”。当用户按下“从JSON形式提交”按钮,如果用户没有填写它显示字段‘’如果用户填写的价值,但不相同的彭定康比说。而‘无效值’。可我们表现出不同的消息不同的情况该领域是必需的。
我用这个插件https://github.com/Textalk/angular-schema-form/blob/master/docs/index.md#validation-messages我使这个plunker http://plnkr.co/edit/ZNJO3x3IqajjdMNStJMF? p =预览
angular.module('test',['schemaForm']).controller('FormController', function($scope,$http){
$scope.schema = {
type: "object",
properties: {
name: { type: "string", minLength: 2, title: "Name", description: "Name or alias" ,required:true,"default": "dddd"},
"student": { type: "string", title: "studentname", description: "Name or student" ,required:false},
"email": {
"title": "Email",
"type": "string",
"pattern":"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*",
"description": "Email will be used for evil.",
required:true
},
title: {
type: "string",
required:true,
enum: ['dr','jr','sir','mrs','mr','NaN','dj'],
}
}
};
$scope.form = [
"*",
{
type: "submit",
title: "Save"
}
];