angular-autoFields-bootstrap
angular-autoFields-bootstrap copied to clipboard
attr for multiple field
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.
Nice. Can you submit a pull request so I can get this into the project?