Closed plopen closed 7 years ago
Please create a demo demonstrating your issue.
In modal html code:
`
`
in ion-datetime-picker directive code: `link: function($scope, $element, $attrs, ngModelCtrl) { $scope.dateEnabled = "date" in $attrs && $attrs.date !== "false"; $scope.timeEnabled = "time" in $attrs && $attrs.time !== "false"; if ($scope.dateEnabled === false && $scope.timeEnabled === false) { $scope.dateEnabled = $scope.timeEnabled = true; } $scope.mondayFirst = "mondayFirst" in $attrs && $attrs.mondayFirst !== "false"; $scope.secondsEnabled = $scope.timeEnabled && "seconds" in $attrs && $attrs.seconds !== "false"; $scope.meridiemEnabled = $scope.timeEnabled && "amPm" in $attrs && $attrs.amPm !== "false"; $scope.monthStep = +$scope.monthStep || 1; $scope.hourStep = +$scope.hourStep || 1; $scope.minuteStep = +$scope.minuteStep || 1; $scope.secondStep = +$scope.secondStep || 1;
$scope.prepare();
ngModelCtrl.$render = function() {
$scope.modelDate = ngModelCtrl.$viewValue;
$scope.processModel();
};
$scope.commit = function() {
$scope.modelDate = new Date($scope.year, $scope.month, $scope.day, $scope.hour, $scope.minute, $scope.second);
ngModelCtrl.$setViewValue($scope.modelDate);
};
var isModal = attr.isModal;
if(isModal == true || isModal == 'true') {
$scope.$on('modal.shown', function() {
$element.on("click", $scope.showPopup);
});
}else {
$element.on("click", $scope.showPopup);
}
}`
need judge whether this view is modal view, and monitor the click event in modal.shown.
Works fine, see codepen. Do you have a different setup?
Do you have update the source code in github? No, I just fork and want to fix this issue in my branch, but I don't know how to mix to min.js.
in codepen, I can't show the modal, are you work with my modal.shown code or use your code?
I have used your modal html, but haven't done any other change to the picker code.
It's working fine in Chrome on both PC and mobile. What's your environment?
if this directive run in modal view, can't monitor click event. it should be in $scope.on('modal.shown', function() { $element.on("click", $scope.showPopup); });