Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

$state.go() changing URL but not correctly loading template

$
0
0

The issue I am having is that I am trying to have a user login to my application and then once they have done so, redirect them to our home page. Up until recently this worked as expected, but now what happens is that the url will change but the template on the new page will not load correctly, showing only a blank screen.

If I use the chrome inspector (with Ionic serve) it shows that the elements have been loaded in the DOM and there doesn't seem to be any CSS hiding it. Similarly, if I refresh the page (which goes directly to the home page as the user has already logged in) it works correctly.

How I am changing state
$ionicHistory.nextViewOptions({
disableAnimate: true,
disableBack: true });
$state.go('myapp.newsfeed)`

My states
$stateProvider

.state('login', {
  url: "/login",
  templateUrl: "templates/login.html",
  controller: "logincontroller"
})

.state('myapp', {
  url: "/myapp",
  abstract: true,
  templateUrl: "templates/menu.html"
})

.state('myapp.newsfeed', {
  url: '/newsfeed',
  views: {
    'menuContent' :{
      templateUrl: "templates/newsfeed.html",
      controller: "globalfeedctrl"
    }
  }
})

Code in globalfeedcontrol that I am sure is being called
$scope.$on('$ionicView.enter', function() {
console.log("We are entering the view");

		if($rootScope.just_logged_in){
			$window.location.reload(true);

			$rootScope.just_logged_in = false;
			$scope.refreshContent();
			$rootScope.$broadcast('store-changed');
			$rootScope.$broadcast('reload-challenges');
			$rootScope.$broadcast('load-hub');
			$rootScope.$broadcast('reload-messages');
			$rootScope.$broadcast('reload-notifications');

			$rootScope.just_logged_in = false;
		}

		if(!initial_load){
			$scope.refreshContent();
		}
		initial_load = false;
		updateEngagement();
	})

I am sure that the controller code is being called both because the statement is logged but also because the network inspector shows that the necessary items are being loaded.

Also note that $window.location.reload(true) is a dirty little hack to get it to work.

Any help that could be provided would be greatly appreciated.


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>