生成的角度形式字段全部包含在其中一个Div中:
<div formly-field ng-repeat="field in fields ">...</div>
我想知道如何为此div添加额外属性?我正在使用flexbox进行响应,并希望将Div渲染为:
<div formly-field ng-repeat="field in fields" flex-gt-sm="50" flex-sm="100" flex-xs="100">...</div>
答案 0 :(得分:0)
您可能需要使用类似
之类的内容覆盖formlyForm模板`
.config(['$provide', Decorate]);
function Decorate($provide) {
$provide.decorator('formlyFormDirective', function($delegate) {
var directive = $delegate[0];
var templateFn = directive.template;
directive.template = function (el, attrs) {
var out = templateFn (el, attrs);
// out is a string so just insert your new attributes wherever you need them
return out;
}
return $delegate;
});
}
`