Skip to content

Commit b4e1bbb

Browse files
committed
#70 disable-parent-scroll attribute
1 parent e5b3c3e commit b4e1bbb

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ The directive accepts several attributes which are described below:
9696
| **today-text** | String | Text for the today button (default: Today) |
9797
| **ok-text** | String | Text for the OK button (default: OK) |
9898
| **week-start** | Number | First day of the week (default: 0 => Sunday) |
99+
| **disable-dates** | Date[] | Dates to be disabled or not selectable by user.|
100+
| **disable-parent-scroll** | Boolean | false => Disable scrolling while the dialog is open (default : false) |
99101

100102
### Date/Time Dialog Service
101103

@@ -126,19 +128,20 @@ The `mdcDateTimeDialog.show` accepts the same options as the directive.
126128
```javascript
127129
{
128130
date: {boolean} =true,
129-
time: {boolean} =true,
130-
format: {string} ='YYYY-MM-DD',
131-
minDate: {strign} =null,
132-
maxDate: {string} =null,
133-
currentDate: {string} =null,
134-
lang: {string} =mdcDatetimePickerDefaultLocale.locale,
135-
weekStart: {int} =0,
136-
shortTime: {boolean} =false,
137-
cancelText: {string} ='Cancel',
138-
todayText: {string} ='Today',
139-
okText: {string} ='OK',
140-
amText: {string} ='AM',
141-
pmText: {string} ='PM'
131+
time: {boolean} =true,
132+
format: {string} ='YYYY-MM-DD',
133+
minDate: {strign} =null,
134+
maxDate: {string} =null,
135+
currentDate: {string} =null,
136+
lang: {string} =mdcDatetimePickerDefaultLocale.locale,
137+
weekStart: {int} =0,
138+
shortTime: {boolean} =false,
139+
cancelText: {string} ='Cancel',
140+
todayText: {string} ='Today',
141+
okText: {string} ='OK',
142+
amText: {string} ='AM',
143+
pmText: {string} ='PM',
144+
disableParentScroll: {boolean} = false,
142145
}
143146
```
144147

js/angular-material-datetimepicker.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@
9292
amText: 'AM',
9393
pmText: 'PM',
9494
todayText: 'Today',
95-
disableDates: []
95+
disableDates: [],
96+
disableParentScroll: false
9697
};
9798
return default_params;
9899
}])
@@ -119,7 +120,8 @@
119120
amText: '@',
120121
pmText: '@',
121122
showTodaysDate: '@',
122-
todayText: '@'
123+
todayText: '@',
124+
disableParentScroll: '='
123125
},
124126
link: function (scope, element, attrs, ngModel) {
125127
var isOn = false;
@@ -179,7 +181,7 @@
179181
openFrom: element,
180182
parent: angular.element(document.body),
181183
bindToController: true,
182-
disableParentScroll: false,
184+
disableParentScroll: options.disableParentScroll || false,
183185
hasBackDrop: false,
184186
multiple: true
185187
})
@@ -221,7 +223,8 @@
221223
todayText: {string} ='Today',
222224
okText: {string} ='OK',
223225
amText: {string} ='AM',
224-
pmText: {string} ='PM'
226+
pmText: {string} ='PM',
227+
disableParentScroll: {boolean} =false
225228
}
226229
@return promise
227230
*/
@@ -237,6 +240,7 @@
237240
params = options[i];
238241
}
239242
}
243+
240244
var locals = {options: options};
241245
$mdDialog.show({
242246
template: template,
@@ -246,7 +250,7 @@
246250
parent: angular.element(document.body),
247251
bindToController: true,
248252
clickOutsideToClose: true,
249-
disableParentScroll: false,
253+
disableParentScroll: options.disableParentScroll || false,
250254
multiple: true
251255
})
252256
.then(function (v) {

0 commit comments

Comments
 (0)