I'm using the pushState
function to populate history
, so alright, but it's time to use windows.history.back()
only to go back once. The function you add is as follows:
function activate_page(sel, have_state)
{
var $dn = $(sel);
var is_vis = $dn.is(":visible");
if(!is_vis)
{
$dn.parents("body").find(".upage").addClass("hidden");
$dn.removeClass("hidden");
window.history.pushState({upage:sel}, sel, document.location.origin + document.location.pathname +sel);
$(document).trigger("pagechange");
}
}
And to go back I use:
angular.module('ionic')
.run(function($ionicPlatform,$ionicPopup, $state,$ionicHistory){
$ionicPlatform.registerBackButtonAction(function (event) {
//console.log(window.history);
if($state.current.name=="app.listar_CELULAS"){
alert("entro aqui");
navigator.app.exitApp();
}
else {
window.history.back();
}
}, 100);
});
I need it to come back all the way to the beginning of the stack, the way it is doing it, it only returns one page.
Thank you in advance.