Use date filter in ng option concatenated field

I am using JSON data to populate a dropdown. Here I have several fields to start and end. I am contacting them with the ng options and using the date filter to change the time of the date. But the filter does not seem to work with the second value inside the ng parameter.

ng-options="(session.SessionStartTime|date:'MMM/dd hh:mm' +'- '+session.max|date:'MMM/dd hh:mm')

it works fine if I do not concatenate two values

Can anyone help

+4
source share
1 answer

take a look at this script to solve your problem

<select
        ng-model="datedemo"
        ng-options="(a.max|date:'MMM/dd hh:mm') +' - '+  (a.SessionStartTime|date:'MMM/dd hh:mm') for a in session"></select>

I found this link where an explanation is made. here is an explanation

+5
source

Source: https://habr.com/ru/post/1614829/


All Articles