Header does not initialize on load


#1

Don’t recall if this is from the recent update, but it started today. The header does not load when opening the app. When navigating to another view, the header appears and looks how it should. I do not have StatusBar plugin installed. It worked fine without the plugin before, so I don’t think it’s because of that. This is happening on both Android and iOS. Nothing special with the menu, code below:

<ion-pane ion-side-menu-content>
	<ion-nav-bar class="bar-ev nav-title-slide-ios7">
		<ion-nav-back-button class="button-clear"><i class="icon ion-chevron-left"></i> Back</ion-nav-back-button>
	</ion-nav-bar>
	<ion-nav-view name="menuContent" animation="slide-left-right"></ion-nav-view>
</ion-pane>

#2

Forgot to mention, it loads fine on the desktop, just doesn’t work on the devices


#3

Ahhhh, I found the issue. It seems google analytics plugin is causing this.


#4

Awesome, glad to see you got this figured out


#5

Maybe there’s a better way to do this, but this is how I had set up google analytics plugin:

.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
	if(window.cordova) {
		analytics.startTrackerWithId('<tracker-ID>');
	}
});

})

Then in my home controller (loads first), I have:

.controller('home', function() {
if(window.cordova) {
	analytics.trackView('Home');
}

})

This causes the header to break, I assume because the controller code runs before $ionicPlatform.ready runs, thus breaking (analytics would not exist yet).

I ended up doing this:

.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
	if(window.cordova) {
		analytics.startTrackerWithId('<tracker-ID>');
		analytics.trackView('Home');
	}
});

})