$ionicPlatform.ready, IonicView issue


#1

Well, I’m facing a very strange issue I hope someone can help me out there.
I have an ionic project, which I usually show it to my clients using the Ionic View.
The application starts with a default view that checks if the user is logged in or not to move him to the proper view.
Unfortunately the code is not running on the ionic view anymore, I have tried to find the problem, but it seems that each time I call ($ionicPlatform.ready(…)) the application fails. Does any one face that same issue ?
This is the code I used in my controller:

MyApp.controller(‘DefaultCtrl’, function ($state, $ionicHistory, $ionicPlatform,$q, Util) {
$ionicPlatform.ready(function () {
var loadingPopup = Util.showToast(“Loading system settings … please wait”, ‘bottom’, ‘short’);
var promises = [];
promises.push(Util.Initialize());
//… wait for all promise to resolve…
$q.all(promises).then(function()
{
var location = Util.GetSelectedLocation();
if (location != null) {
$state.go(“Brand”, {area_id: location[1].areaID});
return;
}
else if (Util.IsLoggedIn()) {
$state.go(‘home’);
}
else {
$state.go(‘login’);
}
});

$ionicHistory.nextViewOptions({
  disableBack: true
});

});

});