One template for iPad, another for iPhone

Hi,
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);
  $stateProvider
    .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??

Thanks

1 Like

Did you ever figure this out?

@henrik242

Try to use ionic.Platform instead $ionicPlatform.
Doc : http://ionicframework.com/docs/api/utility/ionic.Platform.