You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47-2Lines changed: 47 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ npm i ng-material-datetimepicker
47
47
48
48
## Live Example
49
49
50
-
Click [here](https://beenote.github.io/angular-material-datetimepicker/) to see live examples.
50
+
Click [here](https://logbon72.github.io/angular-material-datetimepicker/) to see live examples.
51
51
52
52
## Usage
53
53
@@ -95,6 +95,51 @@ The directive accepts several attributes which are described below:
95
95
|**ok-text**| String | Text for the OK button (default: OK) |
96
96
|**week-start**| Number | First day of the week (default: 0 => Sunday) |
97
97
98
-
### Important Note on Using Locales
98
+
### Date/Time Dialog Service
99
+
100
+
You can also use the Date Time picker as a service, using the `mdcDateTimeDialog` service. The dialog returns a promise which is resolved with the selected date-time value and rejected on cancellation.
101
+
102
+
Example usage:
103
+
104
+
```javascript
105
+
someModule.controller('DemoCtrl', function ($scope, mdcDateTimeDialog) {
106
+
107
+
$scope.displayDialog=function () {
108
+
mdcDateTimeDialog.show({
109
+
maxDate:$scope.maxDate,
110
+
time:false
111
+
})
112
+
.then(function (date) {
113
+
$scope.selectedDateTime= date;
114
+
console.log('New Date / Time selected:', date);
115
+
}, function() {
116
+
console.log('Selection canceled');
117
+
});
118
+
};
119
+
})
120
+
```
121
+
122
+
The `mdcDateTimeDialog.show` accepts the same options as the directive.
Please see this [issue](https://github.com/logbon72/angular-material-datetimepicker/issues/51). To use a locale with your date time picker dialog, you'll have to include the moment.js locale file.
0 commit comments