Home page showing blank, not executing any code in controller --> issue exists only in Android device


#1

Hi,
i have a basic ionic tabs app. On load of the page i need to make a service call to get the data and construct template using the data returned from backend.
when i load the page it loads absolutely fine in chrome. But when i open it in mobile it shows a blank page.

here is my config code:
mobileApp.config(function($stateProvider, $urlRouterProvider) {
alert(“in config mobileapp”);
$stateProvider

  // setup an abstract state for the tabs directive
    .state('tab', {
    url: "/tab",
    "abstract": true,
    templateUrl: "../tabs.html"
  })
  
  // state for home page
    .state('tab.home', {
	    url: "/home",
	    resolve:{
        	resolve function to get data
        },
	    views: {
	      'tab-home': {
		    templateUrl: ../homeTemplate.html',
		    controller: 'homeController'
		   }
		}
  })
  // if none of the above states are matched, use this as the fallback(by default load home page)
.state("otherwise", {
	    url: "*path",
	    template: "",
	    controller: [
	              '$state',
	      function($state) {
	        $state.go('tab.home')
	      }]
	});
  //$urlRouterProvider.otherwise('/tab/home');

}

Controller:

homeModule.controller(‘homeController’,[’$scope’,‘data’, function($scope,data) {
$scope.data = data;
alert(“in controller”); // code not even reaching here
}]);

it is getting redirected to tab/home but the page is empty and i see a empty screen. none of the alert messages are displayed.

i am stuck on this from 2 days. Any help would be appreciated.


#2

i think it’s a problem with the urls of your templates.
you probably should’nt write …/xxxx.html
try removing the …/ or if your template files are in a specific folder just write templatefolder/xxxx.html.
Keep in mind that the files tree is not exactly the same when running on your device.

You should use chrome devtools (chrome://inspect/#devices in your browser) to figure this out.


#3

Thanks a lot for the reply…I am using full path in my actual code…
i figured out now that the page is loading in iphone and its not loading in android devices.
when i inspect the element for ion-nav-view i see the nav-view-transitition=“ios” so i think the page was not loading up on android devices.
Have to dig out the documentation about nav-view-transition.


#4

I still have the issue and it exists only on android devices :frowning:
alert() is not showing up on android devices but its showing on ios devices


#5

just a short guess, you said you get data from an external server
did you install the cordova-plugin-whitelist?
in the new versions it’s necessary to make external calls under android