0
我對Angular Schema形式是全新的,並且試圖創建一些形式來顯示在我的html頁面上。我想知道如何以及如何在this page中定義form content
和schema content
。我在哪些文件中放置這些代碼行,以及如何調用要在HTML頁面中顯示的表單?Angular Schema Forms
表
[
"name",
"email",
{
"key": "comment",
"type": "textarea",
"placeholder": "Make a comment"
},
{
"type": "submit",
"style": "btn-info",
"title": "OK"
}
]
模式
{
"type": "object",
"title": "Comment",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"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!"
}
},
"required": [
"name",
"email",
"comment"
]
}
幫助在這方面有一些詳細的初級支持的準則將非常感激。
所以,我該把這個代碼在控制器內的JavaScript文件,並從我的html頁面調用它呢? (忍受我,對此非常陌生) –
是的,把它放在一個JavaScript文件中,並將其包含在html模板中。我將模板代碼添加到我的答案中。 – kenda
非常感謝。我也想知道我需要在html文件的'
'部分鏈接哪些外部資源才能使其工作 –