Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attr for multiple field #33

Open
fifonik opened this issue Feb 12, 2015 · 1 comment
Open

attr for multiple field #33

fifonik opened this issue Feb 12, 2015 · 1 comment

Comments

@fifonik
Copy link

fifonik commented Feb 12, 2015

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.

@JustMaier
Copy link
Owner

Nice. Can you submit a pull request so I can get this into the project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants