@@ -56,9 +56,26 @@ function MdBottomSheetDirective($mdBottomSheet) {
56
56
* app.controller('MyController', function($scope, $mdBottomSheet) {
57
57
* $scope.openBottomSheet = function() {
58
58
* $mdBottomSheet.show({
59
- * template: '<md-bottom-sheet>Hello!</md-bottom-sheet>'
59
+ * template: '<md-bottom-sheet>' +
60
+ * 'Hello! <md-button ng-click="closeBottomSheet()">Close</md-button>' +
61
+ * '</md-bottom-sheet>'
62
+ * })
63
+ *
64
+ * // Fires when the hide() method is used
65
+ * .then(function() {
66
+ * console.log('You clicked the button to close the bottom sheet!');
67
+ * })
68
+ *
69
+ * // Fires when the cancel() method is used
70
+ * .catch(function() {
71
+ * console.log('You hit escape or clicked the backdrop to close.');
60
72
* });
61
73
* };
74
+ *
75
+ * $scope.closeBottomSheet = function($scope, $mdBottomSheet) {
76
+ * $mdBottomSheet.hide();
77
+ * }
78
+ *
62
79
* });
63
80
* </hljs>
64
81
*/
@@ -70,6 +87,14 @@ function MdBottomSheetDirective($mdBottomSheet) {
70
87
* @description
71
88
* Show a bottom sheet with the specified options.
72
89
*
90
+ * <em><b>Note:</b> You should <b>always</b> provide a `.catch()` method in case the user hits the
91
+ * `esc` key or clicks the background to close. In this case, the `cancel()` method will
92
+ * automatically be called on the bottom sheet which will `reject()` the promise. See the @usage
93
+ * section above for an example.
94
+ *
95
+ * Newer versions of Angular will throw a `Possibly unhandled rejection` exception if you forget
96
+ * this.</em>
97
+ *
73
98
* @param {object } options An options object, with the following properties:
74
99
*
75
100
* - `templateUrl` - `{string=}`: The url of an html template file that will
@@ -110,7 +135,10 @@ function MdBottomSheetDirective($mdBottomSheet) {
110
135
*
111
136
* @description
112
137
* Hide the existing bottom sheet and resolve the promise returned from
113
- * `$mdBottomSheet.show()`. This call will close the most recently opened/current bottomsheet (if any).
138
+ * `$mdBottomSheet.show()`. This call will close the most recently opened/current bottomsheet (if
139
+ * any).
140
+ *
141
+ * <em><b>Note:</b> Use a `.then()` on your `.show()` to handle this callback.</em>
114
142
*
115
143
* @param {*= } response An argument for the resolved promise.
116
144
*
@@ -124,6 +152,8 @@ function MdBottomSheetDirective($mdBottomSheet) {
124
152
* Hide the existing bottom sheet and reject the promise returned from
125
153
* `$mdBottomSheet.show()`.
126
154
*
155
+ * <em><b>Note:</b> Use a `.catch()` on your `.show()` to handle this callback.</em>
156
+ *
127
157
* @param {*= } response An argument for the rejected promise.
128
158
*
129
159
*/
0 commit comments