How To Set Default Time To Html Input Field Of Type Time In Ionic
I am new to Ionic, I am using html input field of type time for getting time picker in Ionic, I want to set some default time to that input field. I tried the following code.
Solution 1:
javaScript doesn't have times solely, we need to provide the parameter ans date-times.
You can do this in following way
<label class="item item-input">
<span class="input-label">Time</span>
<input type="time" ng-model="demoTime">
</label>
In your controller set time like this
$scope.demoTime = new Date (new Date().toDateString() + ' ' + '10:45');
Solution 2:
You can assign value by
$scope.demoTime = "10:45";
OR
<input type="time" value="10:45">
since input type time is based on 24hour time format.
Similar question is answered here
Post a Comment for "How To Set Default Time To Html Input Field Of Type Time In Ionic"