Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 6e91c62

Browse files
committed
fix(panel): demos need to access locals in controller's $onInit
- panel basic demo's menu was throwing an exception - fix missing div in panel basic demo template - clean up comments and API docs for panel, toast, dialog, and bottom sheet
1 parent 91300ec commit 6e91c62

File tree

9 files changed

+183
-219
lines changed

9 files changed

+183
-219
lines changed

src/components/bottomSheet/bottom-sheet.js

+25-26
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function MdBottomSheetDirective($mdBottomSheet) {
109109
* </hljs>
110110
*/
111111

112-
/**
112+
/**
113113
* @ngdoc method
114114
* @name $mdBottomSheet#show
115115
*
@@ -124,39 +124,42 @@ function MdBottomSheetDirective($mdBottomSheet) {
124124
* Newer versions of Angular will throw a `Possibly unhandled rejection` exception if you forget
125125
* this.</em>
126126
*
127-
* @param {object} optionsOrPreset Either provide an `$mdBottomSheetPreset` defined during the config phase or
128-
* an options object, with the following properties:
127+
* @param {Object} optionsOrPreset Either provide an `$mdBottomSheetPreset` defined during the
128+
* config phase or an options object, with the following properties:
129129
*
130130
* - `templateUrl` - `{string=}`: The url of an html template file that will
131131
* be used as the content of the bottom sheet. Restrictions: the template must
132132
* have an outer `md-bottom-sheet` element.
133133
* - `template` - `{string=}`: Same as templateUrl, except this is an actual
134134
* template string.
135-
* - `scope` - `{object=}`: the scope to link the template / controller to. If none is specified, it will create a new child scope.
136-
* This scope will be destroyed when the bottom sheet is removed unless `preserveScope` is set to true.
137-
* - `preserveScope` - `{boolean=}`: whether to preserve the scope when the element is removed. Default is false
135+
* - `scope` - `{Object=}`: the scope to link the template / controller to. If none is specified,
136+
* it will create a new child scope. This scope will be destroyed when the bottom sheet is
137+
* removed unless `preserveScope` is set to true.
138+
* - `preserveScope` - `{boolean=}`: whether to preserve the scope when the element is removed.
139+
* Default is false
138140
* - `controller` - `{string=}`: The controller to associate with this bottom sheet.
139-
* - `locals` - `{string=}`: An object containing key/value pairs. The keys will
140-
* be used as names of values to inject into the controller. For example,
141-
* `locals: {three: 3}` would inject `three` into the controller with the value
142-
* of 3.
141+
* - `locals` - `{string=}`: An object containing key/value pairs. The keys will be used as names
142+
* of values to inject into the controller. For example, `locals: {three: 3}` would inject
143+
* `three` into the controller with the value of 3.
143144
* - `clickOutsideToClose` - `{boolean=}`: Whether the user can click outside the bottom sheet to
144145
* close it. Default true.
145-
* - `bindToController` - `{boolean=}`: When set to true, the locals will be bound to the controller instance.
146+
* - `bindToController` - `{boolean=}`: When set to true, the locals will be bound to the
147+
* controller instance and available in it's $onInit function.
146148
* - `disableBackdrop` - `{boolean=}`: When set to true, the bottomsheet will not show a backdrop.
147149
* - `escapeToClose` - `{boolean=}`: Whether the user can press escape to close the bottom sheet.
148150
* Default true.
149-
* - `isLockedOpen` - `{boolean=}`: Disables all default ways of closing the bottom sheet. **Note:** this will override
150-
* the `clickOutsideToClose` and `escapeToClose` options, leaving only the `hide` and `cancel`
151-
* methods as ways of closing the bottom sheet. Defaults to false.
152-
* - `resolve` - `{object=}`: Similar to locals, except it takes promises as values
151+
* - `isLockedOpen` - `{boolean=}`: Disables all default ways of closing the bottom sheet.
152+
* **Note:** this will override the `clickOutsideToClose` and `escapeToClose` options, leaving
153+
* only the `hide` and `cancel` methods as ways of closing the bottom sheet. Defaults to false.
154+
* - `resolve` - `{Object=}`: Similar to locals, except it takes promises as values
153155
* and the bottom sheet will not open until the promises resolve.
154156
* - `controllerAs` - `{string=}`: An alias to assign the controller to on the scope.
155-
* - `parent` - `{element=}`: The element to append the bottom sheet to. The `parent` may be a `function`, `string`,
156-
* `object`, or null. Defaults to appending to the body of the root element (or the root element) of the application.
157+
* - `parent` - `{element=}`: The element to append the bottom sheet to. The `parent` may be a
158+
* `function`, `string`, `Object`, or null. Defaults to appending to the body of the root element
159+
* (or the root element) of the application.
157160
* e.g. angular.element(document.getElementById('content')) or "#content"
158-
* - `disableParentScroll` - `{boolean=}`: Whether to disable scrolling while the bottom sheet is open.
159-
* Default true.
161+
* - `disableParentScroll` - `{boolean=}`: Whether to disable scrolling while the bottom sheet is
162+
* open. Default true.
160163
*
161164
* @returns {promise} A promise that can be resolved with `$mdBottomSheet.hide()` or
162165
* rejected with `$mdBottomSheet.cancel()`.
@@ -218,9 +221,7 @@ function MdBottomSheetProvider($$interimElementProvider) {
218221
isLockedOpen: false
219222
};
220223

221-
222-
function onShow(scope, element, options, controller) {
223-
224+
function onShow(scope, element, options) {
224225
element = $mdUtil.extractElementByName(element, 'md-bottom-sheet');
225226

226227
// prevent tab focus or click focus on the bottom-sheet container
@@ -303,8 +304,8 @@ function MdBottomSheetProvider($$interimElementProvider) {
303304

304305
/**
305306
* Adds the drag gestures to the bottom sheet.
306-
* @param {angular.JQLite} element where CSS transitions will be applied
307-
* @param {angular.JQLite} parent used for registering gesture listeners
307+
* @param {JQLite} element where CSS transitions will be applied
308+
* @param {JQLite} parent used for registering gesture listeners
308309
* @return {Function} function that removes gesture listeners that were set up by
309310
* registerGestures()
310311
*/
@@ -348,7 +349,5 @@ function MdBottomSheetProvider($$interimElementProvider) {
348349
}
349350
}
350351
}
351-
352352
}
353-
354353
}

0 commit comments

Comments
 (0)