【发布时间】:2016-04-10 19:38:48
【问题描述】:
我正在尝试在离子模式中使用角度材料 md-datepicker,并且在使用 datepicker 并且更改日期时没有触发 ng-change 事件,datepicker 本身不会滚动,并且不会t 似乎可点击。当我尝试在模式之外使用日期选择器时,一切正常。这是怎么回事?
<script id="add-location-modal.html" type="text/ng-template">
<ion-modal-view>
<ion-content>
<md-content layout-padding>
<form name="myForm" style="">
<md-datepicker ng-model="date" ng-change="updateDate(date)" md-placeholder="Date"></md-datepicker>
</form>
</md-content>
</ion-content>
这里是控制器:
angular.module('myModule')
.controller('TripDetailsCtrl'['$scope','$rootScope','$stateParams','tripServices','tripLocationServices','$ionicModal',
function($scope,$rootScope,$stateParams,tripServices,tripLocationServices,$ionicModal){
$scope.trip = [],$scope.tripData = {}, $scope.addLocationModal, $scope.locationData = {},$scope.date;
$scope.showAddLocationModal = function(){
$scope.addLocationModal.show();
};
$scope.closeAddLocationModal = function(){
$scope.addLocationModal.hide();
};
var initModal = function(){
if(!$scope.addLocationModal){
$ionicModal.fromTemplateUrl('add-location-modal.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.addLocationModal = modal;
});
}
};
initModal();
【问题讨论】:
-
日期选择器的 z-index 低于模态的 z-index 是否有问题?我用 CSS 解决的 ui-bootstrap modal 和 md-datepicker 有同样的问题:
.md-datepicker-calendar-pane { z-index: 1151!important; }. -
这也让我想到了,我确实尝试过修改 z-index 但没有任何运气。这样做时我没有使用重要标签,所以我可以尝试一下,但是,我现在怀疑这与Ionic's 300ms click delay有关
标签: datepicker ionic-framework modal-dialog angular-material