Hi I have been using ionic for a while, everything worked fine until recently I encountered a strange issue.
When I enter into a specific state in mobile or in a browser that state keeps on reloading again and again automatically.
.state('app.milestone', { url: '/milestone/list/', resolve : { past : function (Session, milestonesService) { var userId = Session.getUser().userId; var date = moment().locale('en').format('YYYY-MM-DD'); var milestone = milestonesService.getPast(userId, date, 1 ,{"loading" : false}); return milestone; }, future : function (Session, milestonesService) { var userId = Session.getUser().userId; var date = moment().locale('en').format('YYYY-MM-DD'); return milestonesService.getFuture(userId, date, 1, {"loading" : false}); }, }, views: { 'menuContent': { templateUrl : 'app/milestone/milestone.html', controller : 'milestoneController as vm' } } })
The above is the state definition.
`var restore = JSON.parse(localStorage.getItem('userdata'));
var otherwise = "";
if(restore) {
if (restore.userId) {
otherwise = 'app/recent/list';
} else {
otherwise = '/login';
}
}else {
otherwise = '/login';
}
$urlRouterProvider.otherwise(otherwise);`
This is the otherwise declaration. I google many things and can’t find any similar issues or solution. I added some debug to the ui-router and what I got is below.
$stateChangeStart to undefined- fired when the transition begins. toState,toParams :
Object {url: "/milestone/list/", resolve: Object, views: Object, name: "app.milestone"} Object {}
$stateChangeSuccess to app.milestone- fired once the state transition is complete.
is there anyone who encountered any similar issue? Please help me.
NOTE : I used two ionic scrolls inside an ionic content on the view of this state, if that helps in anyway