IONIC side menu isopen issue

Hi I am new to ionic what I am trying to create here is if side menu is open and user click back from phone then using the if condition we will check first if isMenu open, if yes then close the menu else give ask user if he wants to exit the app
I used if condition like below
This returns function.

Could anyone help to share an example how it can return isOpen boolean variable