2016-05-23 15 views
1

我正在使用角度架構窗體。我遇到的問題是,當我嘗試加載表單時,有一些必需的屬性丟失了!該表格並沒有說明有關缺失的屬性。但是,當我點擊特定的字段並編輯某些內容然後刪除它時,它確實會爲我突出顯示該字段。我希望在初始加載時也發生這種情況。尋找指針。由於角度架構窗體+突出顯示帶有窗體加載錯誤的字段

回答

0

你需要在你的形式配置模式使用需要屬性:

//..other fields 
"required": [ 
    "name", 
    "email", 
    "comment" 
    ] 

檢查demo here,它所需的字段,以及:

{ 
    "type": "object", 
    "title": "Comment", 
    "properties": { 
    "name": { 
     "title": "Name", 
     "type": "string" 
    },//here validation details 
    "email": { 
     "title": "Email", 
     "type": "string", 
     "pattern": "^\\[email protected]\\S+$", 
     "description": "Email will be used for evil." 
    }, 
    "comment": { 
     "title": "Comment", 
     "type": "string", 
     "maxLength": 20, 
     "validationMessage": "Don't be greedy!" 
    } 
    },//here naming fields required 
    "required": ["name","email","comment"] 
}