How to dynamic hide / show icon in header bar

Hi! I’m new in ionic.
I build new project but i have some issue with my project
I don’t know how to hide /show button in header bar in other state
Example
I want show icon cart in State 1 , State 2 … But State 3 State 4 will not show


I trying rootscope but it not work.
And other issue .
State 1 Not Show button> GO to State 2 - > Show button. Then go back State 1 . Show button .
I useing Ionic version 1.1.1

Normally, for a DIV or whatever, you add a ng-show="showIcons()" which calls a javascript function in the page controller which returns true/false.
You may be able to do this for the buttons.

But when you click back button the function will not work . how can resovle this bug ?

disable cache on affected views or use ui router events to set this condition

router events to set this condition
Dear Ebreo , Please give me exmple . Thank you :wink:

https://github.com/angular-ui/ui-router/wiki#state-change-events and you could try with fromState, toState