master controller is “Appctrl” .i added localStorage for store token key.when app open have to check that.if token expired.have to direct to login page.functions are working.but after splash screen, until authentication function finish,the screen was white background.how to avoid it?code pattern or any idea for it? thank you
here is controllers.js
angular.module(‘app.controllers’, [])
/**
*App Controller 1st run
*/
.controller(‘AppCtrl’, function ($scope, $state, $ionicPopup, AuthService, AUTH_EVENTS,$ionicPlatform,$ionicLoading, $compile, $cordovaGeolocation,GetDeviceInfo,CurrentLocation) {
console.log("app controller");
$scope.username = AuthService.username();
$scope.$on(AUTH_EVENTS.notAuthenticated, function(event) {
AuthService.logout();
});
$scope.setCurrentUsername = function(name) {
$scope.username = name;
};
});
/**************************************************/
this is my index.html
<body ng-app="app" ng-controller="AppCtrl">
<ion-nav-view></ion-nav-view>
</body>
/*******************************************/
this is app.js file
.config(function($stateProvider, $urlRouterProvider,USER_ROLES) {
$stateProvider
.state('home', {
url: "/home",
templateUrl: "templates/home.html",
controller: 'AppCtrl'
})
.state('login', {
url: "/login",
controller: 'LoginCtrl',
templateUrl: "templates/login.html"
})
.state('main', {
url: "/main",
controller: 'MainCtrl',
templateUrl: "templates/main.html"
});
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/main');
})