Angular-正式。设置类型选项

Angular-formly. SetType options

当我在 angular 中使用 setType 创建新类型时,我如何在模板中显示选项。

我想要一个名为 category 的类型,在网页上显示标签,那么如何 gwt 标签名称?

到目前为止我的代码:

//new type for adding a category label
formlyConfig.setType([
      {
            name:'category',
            template: '<div><center><b>"options.label"</b></center></div>'
      }
]);

print是我要在页面上显示的变量,formlyField是formly数组。

formlyField.push(
     {
            type: 'category',
            templateOptions: {
                label: print
            }

     }
);

试试这个:

//new type for adding a category label
formlyConfig.setType([
      {
            name:'category',
            template: '<div><center><b>{{options.label}}</b></center></div>'
      }
]);

以及您的字段

formlyField.push(
     {
            type: 'category',
            templateOptions: {
                label: 'print'
            }

     }
);