我对 Angular 很陌生 - 请耐心等待:) 我想要一个嵌套表单 - 类似于:
name:{
firstname:"",
lastname:"",
}
这是我的“正式”功能:
this.getFormFields = function (categories) {
var meta={
metadata:{
title:"hello",
description:"test123",
}
}
return [{
key: 'name',
type: 'input',
templateOptions: {
label: gettextCatalog.getString('Name'),
required: true
}
},
{
key: 'metadata',
type: 'input',
model:meta.metadata,
templateOptions: {
label: "metadata title",
}
},
{
key: 'clientId',
type: 'input',
templateOptions: {
required:true,
label: "clientId"
}
},
}];
};
那么如何添加嵌套字段呢?
最佳答案
你很幸运!在 Angular-formly 的 7.0.0 版本(昨天推出)中,这变得非常简单。这是an example .
对于您的具体情况,您可能会这样做:
{
key: 'name.firstname',
type: 'input',
templateOptions: {
label: 'First Name'
}
}
关于javascript - Angularjs 正式嵌套形式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32461344/