I'm looping through an array called fieldset.fields
Everything works fine, except when it comes to this:
type="{{field.type || 'text'}}"
most values work, 'like' test and 'asdf' but if i set the the field.type = file
, and look in the inspector, it says type="text", removing the default attribute(type="{{field.type}}"
) doesn't help either.
sample array: { label: 'First Name', name: 'firstname', key: 'entry.810220554', type: 'text', required: true }, { label: 'Bild', name: 'image', key: 'entry.810220554', type: 'file', required: true },
full template:
<div
ng-repeat="field in fieldset.fields"
ng-switch="field.type"
>
<div class="fieldset" ng-switch-when="radio" class="options">
<!--radiobuttons-->
<div class="radiobutton" ng-repeat="mylabel in field.labels">
<input
type="radio"
name="{{field['key']}}"
value="{{mylabel.name}}"
id="{{mylabel.name}}"
ng-model='$parent.my_radio_button'
ng-class='{ selected: (my_radio_button == mylabel.name) }'
>
<label for="{{mylabel.name}}">
{{mylabel.label}}
</label>
</div>
</div>
<label
ng-switch-default
for="{{field.name}}"
>
{{field.label}}
</label>
<!--text-input-->
<input
ng-switch-default
type="{{field.type || 'text'}}"
name="{{field.key}}"
id="{{field.name}}"
ng-required="field.required"
/>
</div>
</div>