1

I'm developing an Ionic 2 web/mobile app and I'm planning on using the same code base for the mobile and desktop app. The Ionic components look nice on mobile devices but are not efficient in a desktop app with the viewport size in a normal browser.

At the moment I'm thinking about doing the check inside the template file which I think is not nice and can get become nasty code.

<span *ngIf="!platform.is('core')">
  <ion-header>

  <ion-navbar>
    <button ion-button icon-only menuToggle>
      <ion-icon name="menu"></ion-icon>
    </button>

    <ion-title>
      Title
    </ion-title>
  </ion-navbar>

</ion-header>

<ion-content>

  <ion-list>
    <button ion-item *ngFor="let item of items" (click)="open(item)">
      {{item.label}}
    </button>

  </ion-list>

</ion-content>
</span>

<span *ngIf="platform.is('core')">

    // using non ionic components, smart tables and stuff

</span>

Is there any way of splitting it in two/several template files?

Heiko
  • 304
  • 1
  • 10

0 Answers0