I use the following code
<pre>Selected date is: <em>{{tournament.startDate | date:'fullDate' }}</em></pre>
<input name=startDate" id="startDate" type="text" class="form-control" uib-datepicker-popup="{{format}}" ng-model="tournament.startDate" is-open="popup1.opened"
ng-required="true" close-text="Schließen""
datepicker-options="dateOptions" alt-input-formats="altInputFormats" />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open1()"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
and my controller
$scope.tournament = Tournament.get({id: $routeParams.id});
$scope.dateOptions = {
dateDisabled: false,
formatYear: 'yy',
maxDate: new Date(2020, 5, 22),
minDate: new Date(),
startingDay: 1
};
The value of tournament.startDate is shown in the pre-Tag but not in the input field. The opened datepicker show the correct date.
It seems to be a synchronized problem, cause if I change the controller to
$scope.tournament = new Object();
$scope.tournament.startDate = new Date();
the date is shown in the input field.
Edit: The scope is filled with the correct date but the inputfield don not show the value.
Thanks for help chokdee
Found it by mself, that the REST Service give back a String not a Date object, after converting it it's working fine.
But in my opinion angular-ui should raise an exception if the cannot convert the given object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With