-1

please explain me in a words why it works perfect when I call ons.slidingMenu.toggleMenu() having at the same time myMenu as variable of <ons-sliding-menu ....var="myMenu">

I mean I should call myMenu.toggleMenu(), not ons.slidingMenu.toggleMenu() ....

I think that ons.slidingMenu is defined deep inside onsen. Where I could read about all this hidden vars? (I've found nothing about it in onsen-ui site)

Thanks!

Gluhar
  • 1
  • I use myMenu.toggleMenu() all the time and it worked as expected. It should work both ways. As you can see on their example 'http://codepen.io/onsen/pen/IDvFJ' and look for `ng-click="menu.toggleMenu()"` – Vu Nguyen Oct 29 '14 at 14:52
  • Yes it works, but do u know what is ons.slidingMenu ? I have some unpleasant feeling that I did get something in AngularJS ... – Gluhar Oct 29 '14 at 21:06

1 Answers1

3

It's the same object, but I would advice using the one you get using the var="..." attribute.

Actually if you have a navigator you get an ons.navigator variable as well. If you have many of the same type of component it will refer to the one that was parsed most recently.

Andreas Argelius
  • 3,604
  • 1
  • 13
  • 22