Reputation: 229
I receive some json data from a web API. This json data consists of a series of datetimes.
I want to be able to select a particular datetime from a dropdown list. There is no problem populating the list, but the formatting is incorrect, and I don't know how to make it right.
The selected datetime is going to be used afterwards.
I'm using Angular and don't mind using some other 3rdparty tool like moment.js
Currently it looks like this:
EDIT: I'm populating the dropdown in the following way:
<select class="inputIndkald" id="tidspunktDropdown" ng-model="indkald.tidspunkt" ng-options="tidspunkt.dateTime for tidspunkt in indkaldTidspunkt"><option value="">Vælg...</option></select>
I hope you guys can help me out.
Upvotes: 0
Views: 2397
Reputation: 524
[..old answer not relevant ...]
UPDATE:
I have never done this myself but have you tried something like:
<select
class="inputIndkald"
id="tidspunktDropdown"
ng-model="indkald.tidspunkt"
ng-options="tidspunkt.dateTime as tidspunkt|date:'HH:mm:ss dd.MM.yyyy' for tidspunkt in indkaldTidspunkt ">
<option value="">Vælg...</option>
</select>
Upvotes: 5