Disable back button on condition

My app starts in a sidemenu with the subviews A,B,C. Now I have connected some subviews such that I can navigate from the submenu -> A -> B . However, B now will have a backbutton to go back to A and the menu button to go back to the sidemenu in the upper left corner.
How can I disable the display of either one of them based on a JS condition?

Hey having the same problem… did you find an answer?

Sure enough found an answer seconds later… user the nav-clear directive to remove the back button ie…

<a href="#/app/myview" nav-clear>Link</a>

Thanks, the back button is gone, but how can one disable the menu?
Also, I sometimes trigger the other views by using $state.go , sometimes a regular link.