Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49257

Display dates in select component not select first option by default

$
0
0

@anubro wrote:

Below is the select component code:

<label class="item item-input">
<span class="input-label">Date</span>
<select ng-model="loginData.bookingdate" style=" width:100%; text-align:center;" ng-change="update()">
<option selected="selected" ng-repeat-start="item in mydate3" value="{{item.title | date:'yyyy-MM-dd' }}" ng-if="$first" Today>
{{item.title | date:'dd-MM-yyyy EEEE' }} Today
</option>
<option ng-repeat-end value="{{item.title | date:'yyyy-MM-dd' }}" ng-if="!$first">
{{item.title | date:'dd-MM-yyyy EEEE' }}
</option>
</select>
</label>

and mydate3 in controller file is something like :

`$scope.mydate3 =
[
{ title: new Date().setDate(new Date().getDate()) },
{ title: new Date().setDate(new Date().getDate() + 1) },
{ title: new Date().setDate(new Date().getDate() + 2) },
{ title: new Date().setDate(new Date().getDate() + 3) },
{ title: new Date().setDate(new Date().getDate() + 4) },
{ title: new Date().setDate(new Date().getDate() + 5) },
{ title: new Date().setDate(new Date().getDate() + 6) },
{ title: new Date().setDate(new Date().getDate() + 7) }

    ];

`

I am unable to get select first option of the select component by default though I used selected="selected", there is white empty option exists.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49257

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>