我正在从模型中动态构建表单:
export class Link {
@required
text: string = "";
@required
url: string = "";
}
我希望能够在装饰器中添加描述并渲染它,如下所示:
export class Link {
@required
@description('This is the text that will display in the browser')
text: string = "";
@required
url: string = "";
}
有人知道如何做到这一点吗?
修改
用例的用例是能够以动态构建的形式显示:
<form if.bind="editMode === 2" role="form" validation-renderer="validation-renderer">
<div class="labeled-field form-group" repeat.for="key of editSetting.data | objectKeys">
<span class="label">${key | camelCaseToWords}</span>
<input class="input" type="text" value.bind="editSetting.data[key] & validate" />
</div>
</form>