0

How to close the menu dropdown once clicked using typescript. I am able to do using jQuery but I am working on angular 2. I would like to it in typescript

AT82
  • 67,510
  • 23
  • 129
  • 159
sweety
  • 1
  • https://stackoverflow.com/a/35713421/4248328 – Anant Kumar Singh Jun 16 '17 at 04:34
  • Possible duplicate of [Angular2 Close dropdown on click outside, is there an easiest way?](https://stackoverflow.com/questions/35712379/angular2-close-dropdown-on-click-outside-is-there-an-easiest-way) – Alexander Jun 16 '17 at 08:46

2 Answers2

0

You can use this :

<div (click)='clicked = !clicked'>
  <menu [hidden]='clicked'>
  .......
  </menu>
</div>
Vivek Doshi
  • 52,153
  • 9
  • 101
  • 113
0

If you are working on ionic 2 then following are the steps to hide menu...

First import Menucontroller from import {MenuController} from 'ionic-angular';

In your component constructor include menuController like this : constructor(app: IonicApp, platform: Platform, menu: MenuController)

Then wherever you wish to close menu do this : this.menu.close();

If you are not using ionic 2 then tell me if u using any plugin in angular for menu? then i can help u with the solution.

Hope this helps..

Irfan Pathan
  • 173
  • 1
  • 2
  • 13