Navigating to new tab does not load the page till page refresh

I am pretty new to Ionic and and trying to learn through the sample codes from codepen.

I am trying to merge to examples of login and loading google map.
The problem is after clicking to login button, the home tab is coming up but the google map is not being loaded. The map is being loaded only after doing a page refresh in my browser. Tried multiple suggestions but till now no luck.
Looks like my controller code for home tab is not being invoked when the state changes.
Can anyone help?

Here is the link for my pen.

The issue is fixed after adding following lines of code

  $scope.$on('$ionicView.enter', function() {