check example on docs: https://ionicframework.com/docs/v2/api/components/datetime/DateTime/ and https://ionicframework.com/docs/v2/components/#datetime
I'm making mobile-app with ionic+angular+cordova in VS. And I want to use simple datetime picker they have on their docs, with year, month & day. As those native looking scrollable selectors.
I've tried this in my page:
<ion-item>
<ion-label>Date:</ion-label>
<ion-datetime displayFormat="YYYY-MM-DD" [(ngModel)]="myDate"></ion-datetime>
</ion-item>
and js:
$scope.myDate = new Date();
$scope.myDate.toISOString();
But nothing else shows up except ion-item and ion-label. How do I make the 'ion-datetime'-element work?
$scope.myDate = new Date().toISOString();
– Issam El-atifYYYY-MM-DD
? It should beyyyy-MM-dd
– Issam El-atifdisplayFormat="yyyy-MM-dd"
still not showing :( – J-hothis
instead of$scope
. trythis.myDate = new Date().toISOString();
– Issam El-atif