12 Commits

Author SHA1 Message Date
004e63555e refactor(menu): improve menu get lookup
If a `menuId` is not provided then it'll return the first menu found.
If a `menuId` is `left` or `right`, then it'll return the enabled menu
on that side. Otherwise, if a `menuId` is provided, then it'll try to
find the menu using the menu's `id` property. If a menu is not found
then it'll return `null`. If a menu id was provided, but was not found,
it will not fallback to finding any menu. Closes #5535
2016-02-19 23:37:31 -06:00
8564d79a7d fix(menu): fix enabled check
references #5535
2016-02-19 20:36:27 -05:00
a2b7a21a95 feat(menu): grab the menu by side only if it is enabled
this removes the need to pass an id when you enable one menu

references #5535
2016-02-19 16:18:31 -05:00
0d47a1b79f feat(menu): allow persistent menus
Closes #5204
2016-02-15 21:40:16 -06:00
c02fb51d04 feat(menu): close any opened menu 2016-02-15 19:42:30 -06:00
ff24152524 fix(menu): add/remove gesture listeners per enabled menu 2016-02-15 13:23:01 -06:00
3bb09cee07 feat(MenuController): create isOpen() and isEnabled()
Closes #5390
2016-02-13 00:54:01 -06:00
019009a3e2 chore(): fix bad types for docs 2016-02-12 16:36:27 -05:00
5941042a98 chore() normalize types in docs 2016-02-12 15:51:28 -05:00
c7a58f0dfc docs(menu): update docs 2016-02-05 15:06:54 -05:00
9f906ae8ae docs(MenuController): update MenuController docs 2016-02-04 20:15:40 -06:00
acf12cdd15 refactor(menu): inject MenuController to control app menus
Menu has been improved to make it easier to open, close, toggle and
enable menus.
Instead of injecting `IonicApp` to find the menu component, you now
inject
`MenuController`.

Was:

```
constructor(app: IonicApp) {
  this.app = app;
}
openMenu() {
  this.app.getComponent('leftMenu').close();
}
```

Now:

To programmatically interact with any menu, you can inject the
`MenuController`
provider into any component or directive. This makes it easy get ahold
of and
control the correct menu instance. By default Ionic will find the app's
menu
without requiring a menu ID. An id attribute on an `<ion-menu>` is only
required
if there are multiple menus on the same side. If there are multiple
menus, but
on different sides, you can use the name of the side to get the correct
menu

If there's only one menu:

```
constructor(menu: MenuController) {
  this.menu = menu;
}
openMenu() {
  this.menu.close();
}
```

If there is a menu on the left and right side:

```
toggleMenu() {
  this.menu.toggle('left');
}
```

If there are multiple menus on the same side:

```
<ion-menu id="myMenuId" side="left">...</ion-menu>
<ion-menu id="otherMenuId" side="left">...</ion-menu>

closeMenu() {
  this.menu.close('myMenuId');
}
```
2016-02-04 16:47:05 -06:00