I'm using ng-repeat to cycle through my returned fields. Every field can have few types, e.g. TextField, NumericField, also DateTimeField.
So I'm looking which type it is and showing that needed input:
<div ng-repeat="field in fields">
<div ng-show="field.fieldtype == 'TextField'">
<input type="text" ng-model="DATA.values[field.key]" />
</div>
<div ng-show="field.fieldtype == 'NumericField'">
<input type="number" ng-model="DATA.values[field.key]" />
</div>
<div ng-show="field.fieldtype == 'DateTimeField'">
<datepicker ng-model="DATA.values[field.key]"></datepicker>
<timepicker ng-model="DATA.values[field.key]"></timepicker>
</div>
</div>
Everything was working as expected until I added datepicker and timepicker. Now my model gets formatted all the time even field type is not DateTimeField, and when entering a value (e.g. in a TextField), I'm getting errors:
Timepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.
Can I tell somehow to those pickers to not format my model or is there any other solution?
DATA.values[field.key]
contain exactly? – Jeroen Noten Jul 29 at 15:43