Access side menu from jQuery mobile - get into controller from outside

Hey again guys,
ionic is of course still very new to me and i’m a bit embarrassed to ask this, but i don’t know where to get a deeper look into these things (combined jQuery, Angular and ionic).

I know, the target is to totaly remove jQuery while using ionic and angular (what i saw till now was totaly great and the free course on codeschool was great to get a first overview.

So, i’m now using jQuery mobile for my single page application. It’s very easy for me to generate single pages and the navigation of course isn’t difficult.

I now want to call a function, which closes my menu after a pagechange has been done. Therefore i have a function which looks like this ->

jQuery(document).on("pageshow", function (e, data) { 
        console.log('PAGE CHANGED');
    })

While this function works fine, i now need to know, whether the menu is opened or not. I got this function for that inside my MainCtrl (it gets updated everytime the menu changes it’s state) ->

sideMenuToggled = $ionicSideMenuDelegate.isOpen(); 

What i want my function now to do is sth which must look like this:

jQuery(document).on("pageshow", function (e, data) { 
    console.log('PAGE CHANGED');

    if(sideMenuToggled == true) {
        $ionicSideMenuDelegate.toggleRight();
    }else{
        console.log('side menu is closed already');
    }
})

So that function should close the side menu when it is opened. I know that there is an attribute called menu-close and i already tried to use that instead of a function but it doesn’t get triggered - the menu still stayes opened.

<ion-item menu-close>
    <a href="/#searchPage" class="blockedLink" data-tap-disabled="true" data-transition="none"> 
        <i class="fa fa-search fa-2x fa-fw abso"></i><p class="navigationPoints">Search</p>
    </a>
</ion-item>

any help would be appreciated - how can i use ionic within jquery?

What I don’t understand now, are you mixing jQuery Mobile and Ionic Framework our are you asking a Ionic Framework question using a jQuery Mobile reference?

right now i’m mixing ionic, angular an jqm >.>

i’m not so familar with ionic yet… the only thing i need jquery for is page containers. Where in angular i can use the routerProvider and templates, as far as i understood it correct

Why oh my God why? jQuery Mobile is such a shit* framework, I know, I was using it almost 3 years.

I would understand mixing AngularJS and jQuery Mobile, I mean, jQM really needs an MVVM support.

But you’re trying to use two UI frameworks at the same time. I simply don’t see the point.

And sorry, I don’t won’t to sound harsh.

1 Like

No you realy don’t sound harsh - of course i know that the combination i did is something… yes… something where i normaly would knock my fist onto my head for hours.

I started with app development 1 1/2 year ago - your tutorials guided me the way inside this big market - besides: Big thanks for that!!

So i think, i’ll forget that question, setup a new blank ionic app and than i’m going to fully start with that. Mixing those 3 is like… drinking a banana/strawberry smoothie with cheese. Thanks Gajotres, it is a small privilege for me to get help from you directly!

1 Like

No problem man, I will always help you as much as I can. :smile:

1 Like