Skip to content

Commit a193cdf

Browse files
committed
#33 add example and readme
1 parent c7c2c79 commit a193cdf

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,16 @@ The `mdcDateTimeDialog.show` accepts almost the same options as the directive.
206206
pmText: {string} ='PM',
207207
disableDates: {date[]} =[],
208208
weekDays: {boolean} =false,
209-
disableParentScroll: {boolean} = false,
209+
disableParentScroll: {boolean} =false,
210210
autoOk: {boolean} =false,
211211
editInput: {boolean} =false,
212212
clickOutsideToClose: {boolean} =false,
213213
minuteSteps: {int} =5,
214214
howIcon: {boolean} =false,
215215
templateUrl: {string} =''
216+
targetEvent: {DOMClickEvent}=null,
217+
openFrom: {string|Element|object}=null,
218+
closeTo: {string|Element|object}=null
216219
}
217220
```
218221

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ <h2>Datetime Pickers</h2>
245245
<div layout-gt-md="row" layout="column" layout-align-gt-md="center center">
246246
<div flex-gt-md="30">
247247
<p>mdcDateTimeDialog Service</p>
248-
<md-button class="md-raised md-primary" ng-click="displayDialog()">
248+
<md-button id="pickerbutton" class="md-raised md-primary" ng-click="displayDialog($event)">
249249
Display Picker
250250
</md-button>
251251
<p ng-if="selectedDateTime">Date: {{selectedDateTime|date:'medium'}}</p>

js/angular-material-datetimepicker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@
263263
controllerAs: 'picker',
264264
locals: {options: options},
265265
openFrom: element,
266+
closeTo: element,
266267
parent: angular.element(document.body),
267268
bindToController: true,
268269
clickOutsideToClose: options.clickOutsideToClose || false,

js/demo.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,16 @@
9090

9191
$scope.langs = [{'value': 'en', 'label': 'English'},{'value': 'fr', 'label': 'Français'}];
9292

93-
$scope.displayDialog = function () {
93+
$scope.displayDialog = function(event) {
9494
mdcDateTimeDialog.show({
9595
currentDate: moment().startOf('day'),
9696
maxDate: $scope.maxDate,
9797
showTodaysDate: '',
9898
time: true,
99-
clickOutsideToClose: true
99+
clickOutsideToClose: true,
100+
targetEvent: event,
101+
openFrom: angular.element(document.querySelector('#pickerbutton')),
102+
closeTo: angular.element(document.querySelector('#pickerbutton'))
100103
})
101104
.then(function (date) {
102105
$scope.selectedDateTime = date;

0 commit comments

Comments
 (0)