<formly-form model="vm.model" fields="step.inputs" options="vm.options">
<div style="text-align:right">
<button type="submit" wz-next class="btn btn-primary submit-button" ng-disabled="innerForm.$invalid">Next</button>
</div>
</formly-form>
By using the code above, a standard formly form would be generated. However, I am facing an issue where I need to dynamically add a class to the formly-field div based on values set in the field's templateOptions
.
For example:
inputs: [
{
key: 'someKey',
type: 'input',
templateOptions: {
label: 'some text',
class: 'floatLeft'
}
},
{
key: 'anotherKey',
type: 'input',
templateOptions: {
label: 'some text',
class: 'floatRight'
}
}]
Should result in the following formly-fields:
<div formly-field ng-repeat="field in fields " class="floatLeft ..." ...>...</div>
<div formly-field ng-repeat="field in fields " class="floatRight ..." ...>...</div>
I have attempted using wrappers, but they do not wrap around the formly-field div. As step.inputs
is an array of fields, I am unsure how to achieve this.