我们可以在输入字段中添加默认值。我创建一个表单,我将json转换为表单。 http://plnkr.co/edit/ZNJO3x3IqajjdMNStJMF?p=preview 我用过这个插件 https://github.com/Textalk/angular-schema-form/blob/master/docs/index.md#validation-messages
已经使用过这个
"value":"dddd"
为什么它不会出现前场或默认值?
$scope.schema = {
type: "object",
properties: {
name: { type: "string", minLength: 2, title: "Name", description: "Name or alias" ,required:true,"value":"dddd"},
"student": { type: "string", title: "studentname", description: "Name or student" ,required:false},
"email": {
"title": "Email",
"type": "string",
"description": "Email will be used for evil.",
required:true
},
title: {
type: "string",
required:true,
enum: ['dr','jr','sir','mrs','mr','NaN','dj'],
}
}
};
我们提供不同的消息..“required:true”。“这些字段是必需的”当用户输入无效的电子邮件时“请输入有效的电子邮件
答案 0 :(得分:1)
代替"value": "dddd"
执行default: "dddd"