Back button


How do you make a back button in Ionic framework? I know I can do something like $location.path(’/previous_view’); but what if you dont know what the previous url is?

I currently have

<button onclick="history.back(-1)" class="button button-icon icon ion-chevron-left"></button>

But it seems buggy on iphone - sometimes it goes 2 views back


Check out this for an introduction for ionic navigation

The nav bar calls this code to go back, you could write your button to call it as well


And this as well: