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

Commit 65746b8

Browse files
committedFeb 22, 2019
docs($mdMenu): add documentation for $mdMenu
currently there is no documentation. Fixes: #11610
1 parent d3773a5 commit 65746b8

File tree

1 file changed

+48
-6
lines changed

1 file changed

+48
-6
lines changed
 

‎src/components/menu/js/menuServiceProvider.js

+48-6
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,56 @@ angular
22
.module('material.components.menu')
33
.provider('$mdMenu', MenuProvider);
44

5+
/** Handles behavior for a menu while it is open, including:
6+
*
7+
* - handling animating the menu opening/closing
8+
* - handling key/mouse events on the menu element
9+
* - handling enabling/disabling scroll while the menu is open
10+
* - handling redrawing during resizes and orientation changes
11+
*/
12+
13+
/**
14+
* @ngdoc service
15+
* @name $mdMenu
16+
* @module material.components.menu
17+
*
18+
* @description
19+
* `$mdMenu` is a service that is available within the scope of an `md-menu` directive.
20+
*
21+
* ## Usage
22+
*
23+
* <hljs lang="html">
24+
* <md-menu>
25+
* <!--Clicking the button will open the menu-->
26+
* <md-button ng-click="$mdMenu.open($event)">
27+
* Open
28+
* </md-button>
29+
* <!--Moving the mouse off will close the menu-->
30+
* <md-menu-content ng-mouseleave="$mdMenu.close()">
31+
* <md-menu-item>
32+
* <md-button ng-click="$mdMenu.close()">Clicking me will also close the menu</md-button>
33+
* </md-menu-item>
34+
* </md-menu-content>
35+
* </md-menu>
36+
* </hljs>
37+
*/
38+
39+
/**
40+
* @ngdoc method
41+
* @name $mdMenu#open
42+
* @param {$event} $event By passing $event as argument, the corresponding event is stopped from propagating up the
43+
* DOM-tree
44+
*
45+
* @description
46+
* Opens the menu within the `md-menu` scope
47+
*/
48+
549
/**
6-
* Interim element provider for the menu.
7-
* Handles behavior for a menu while it is open, including:
8-
* - handling animating the menu opening/closing
9-
* - handling key/mouse events on the menu element
10-
* - handling enabling/disabling scroll while the menu is open
11-
* - handling redrawing during resizes and orientation changes
50+
* @ngdoc method
51+
* @name $mdMenu#close
1252
*
53+
* @description
54+
* Closes the menu within the `md-menu` scope
1355
*/
1456

1557
function MenuProvider($$interimElementProvider) {

0 commit comments

Comments
 (0)
Failed to load comments.