Ionic tab go back to last page not to it's root

I got 2 tabs Buildings and Nearby. Inside Buildings i got a link to Details page, and when I am in Details I click tab Nearby then if I click Buildings tab it goes back to Details not to Buildings tab, only if i click again it reaches Buildings…does any body had this problem already?