Skip to content

attr for multiple field #33

@fifonik

Description

@fifonik

I'd like to add attr: { ngShow: "condition" } to multiple field for show/hide whole row and I can't.
I've done the following changes in my local files:
autofields-bootstrap.js:

        $autofieldsProvider.registerHandler('multiple', function(directive, field, index){
            var row = angular.element('<div/>');
            row.addClass(directive.options.classes.row.join(' '));
+           $autofieldsProvider.setAttributes(directive, field, row, field.attr);

autofields.js:

                    value = value
                        .replace(/\$form/g, directive.formStr)
                        .replace(/\$schema/g, directive.schemaStr)
-                       .replace(/\$type/g, field.type || 'text')
-                       .replace(/\$property_clean/g, field.property.replace(/\[|\]|\./g, ''))
-                       .replace(/\$property/g, field.property)
-                       .replace(/\$data/g, directive.dataStr)
-                       .replace(/\$placeholder/g, field.placeholder != null ? field.placeholder : helper.LabelText(field));
+                       .replace(/\$data/g, directive.dataStr)
+                       .replace(/\$type/g, field.type || 'text');
+                   if (field.property != null) {
+                       value = value
+                           .replace(/\$property_clean/g, field.property.replace(/\[|\]|\./g, ''))
+                           .replace(/\$property/g, field.property);
+                   }
+                   if (field.placeholder != null || field.label != null || field.property != null) {
+                       value = value
+                           .replace(/\$placeholder/g, field.placeholder != null ? field.placeholder : helper.LabelText(field));
+                   }

It would be nice to have something like this worked from the box.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions