[英]Adding attributes to Angular formly “formly-field” div
生成的角度正则字段全部包裹在以下Divs之一中: <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>
of <div formly-field ng-repeat="field in fields" flex-gt-sm="50" flex-sm="100" flex-xs="100">...</div>
您可能需要使用类似的方法覆盖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;
});
}
`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.