-
Notifications
You must be signed in to change notification settings - Fork 101
Added option to use tel type for time fields #72
base: master
Are you sure you want to change the base?
Conversation
Hi Tom, There was some discussion in #3, #42 and #43. It is not possible to use Thanks again for your work! |
How about now? I haven't tested this but it seems straightforward enough... |
This won't work as expected, because |
@@ -13,7 +13,8 @@ angular.module("ion-datetime-picker", ["ionic"]) | |||
hourStep: "=?", | |||
minuteStep: "=?", | |||
secondStep: "=?", | |||
onlyValid: "=?" | |||
onlyValid: "=?", | |||
telTypeForTimeFields: "=?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line (because all boolean attrs are handled differently, see below).
@@ -281,6 +282,10 @@ angular.module("ion-datetime-picker", ["ionic"]) | |||
changeViewData(); | |||
}; | |||
|
|||
$scope.timeFieldType = function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this and instead use the same approach as for example mondayFirst
attr on line 311, in the link function.
$scope.timeFieldType = "useTelType" in $attrs && $attrs.useTelType !== "false" ? "tel" : "text";
use-tel-type
is shorter than tel-type-for-time-fields
and IMHO still expresses its purpose.
@@ -51,23 +51,23 @@ | |||
<label class="col col-20"> | |||
<div class="item item-input"> | |||
<div> | |||
<input type="text" ng-model="bind.hour" pattern="0?([01]?[0-9]|2[0-3])" ng-change="change('hour')" ng-blur="changed()" required> | |||
<input type="{{timeFieldType}}" ng-model="bind.hour" pattern="0?([01]?[0-9]|2[0-3])" ng-change="change('hour')" ng-blur="changed()" required> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use ng-attr-type=
instead of type=
, there were some problems in older browsers with it.
@@ -281,6 +282,10 @@ angular.module("ion-datetime-picker", ["ionic"]) | |||
changeViewData(); | |||
}; | |||
|
|||
$scope.timeFieldType = function() { | |||
return $scope.telTypeForTimeFields ? "tel" : "text"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, please try to maintain the existing code style, including indentation style, even if you think that it's weird and unusual :)
Haven't forgotten about this one! Just short on time ATM. Hope to finish this up within the year :) |
No problem, take your time 👍 |
Maybe you could also add
to the input field, because I got an "ugly" autocorrect bar above the keyboard (KeyboardAccessoryBar) and autocomplete/autocorrect suggestions are not necessary when changing the time ⌛️ 😅 |
Unless there is some reason not to? Thanks for considering!