I have this app.js code in my Ionic App Project. It gives me a blank screen on start, but only when tested on a real device! When I use 'ionic serve' to test the app on the browser it works fine!
angular.module('orderApp', ['ionic'])
.config(function($stateProvider, $urlRouterProvider) {
// Ionic uses AngularUI Router which uses the concept of states
// Learn more here: https://github.com/angular-ui/ui-router
// Set up the various states which the app can be in.
// Each state's controller can be found in controllers.js
//$stateProvide is like routeprovider in classic angularjs
//It controlls the pages
$stateProvider
.state('categories', {
cache: false,
url: "/categories",
templateUrl: "/templates/pages/categories/index.html",
controller: "CategoriesIndexController"
});
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/categories');
});
This issue troubled me a lot!
Turns out to be a weird issue with the $stateProvider in ionic or angularjs. The templateUrl parameter inside the .state should not have a slash in the beginning. Even though this is tolerated by the browsers, it is not tolerated inside the real devices.
So after removing the first slash from
templateUrl: "/templates/pages/products/index.html",
and transformed it to:
templateUrl: "templates/pages/products/index.html",
in each .state, everything worked fine on the real devices too!