Ionic 2 - 针对不同平台的不同模板文件

时间:2017-08-03 11:25:47

标签: ionic2

我正在开发一个Ionic 2网络/移动应用程序,我打算为移动和桌面应用程序使用相同的代码库。 Ionic组件在移动设备上看起来不错,但在普通浏览器中具有视口大小的桌面应用程序效率不高。

目前我正在考虑在模板文件中进行检查,我觉得这样不好,可能会变成讨厌的代码。

<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>

有没有办法将它分成两个/几个模板文件?

0 个答案:

没有答案