One template for iPad, another for iPhone

I’m trying to configure my router so that if the platform is iPad, one template will be used, otherwise another one should be used. How do I get about this?

If I do it like this:

.config(function($stateProvider, $urlRouterProvider, $ionicPlatform){
  console.log('ionic.Platform: %o', $ionicPlatform);
    .state('chapter', {
      url: '/chapter/:chIndex',
      templateUrl: $ionicPlatform.isIPad() ? 'templates/chapter-ipad.html' : 'templates/chapter-iphone.html',
      controller: 'ChapterCtrl',

… I get an error like this:
Uncaught Error: [$injector:modulerr] Failed to instantiate module kdf due to:
Error: [$injector:unpr] Unknown provider: $ionicPlatform

What’s up with that??


1 Like

Did you ever figure this out?


Try to use ionic.Platform instead $ionicPlatform.
Doc :